docker-compose: define mount for bind mount and managed mount

前端 未结 4 974
醉酒成梦
醉酒成梦 2021-02-01 15:17

I\'m using docker-compose for defining my service. In docker, there are two concepts for docker volume. Firstly is about bind mount: mount on host storage.

4条回答
  •  一整个雨季
    2021-02-01 15:52

    Although I am answering very late. But maybe it helps other people in future. Below is the configuration for both types. https://docs.docker.com/compose/compose-file/compose-file-v3/#volumes

    version: "3.2"
    services:
      web:
        image: httpd:latest
        volumes:
          - type: bind
            source: $HOST/location
            target: /container/location
          - type: volume
            source: mydata
            target: /container/location
    volumes:
      mydata:
    

提交回复
热议问题