Docker, mount volumes as readonly

前端 未结 2 534
轮回少年
轮回少年 2021-01-30 01:46

I am working with Docker, and I want to mount a dynamic folder that changes a lot (so I would not have to make a Docker image for each execution, which would be too costly), but

2条回答
  •  悲哀的现实
    2021-01-30 02:31

    docker-compose

    Here is a proper way to specify read-only volume in docker-compose:

    version: "3.2" # Use version 3.2 or above
    services:
      my_service:
        image: my:image
        volumes:
          - type: volume
            source: volume-name
            target: /path/in/container
            read_only: true
    volumes:
      volume-name:
    

    https://docs.docker.com/compose/compose-file/#long-syntax-3

提交回复
热议问题