Mount a volume in docker-compose conditionally

前端 未结 3 863
慢半拍i
慢半拍i 2021-01-07 17:07

I have a docker-compose.yml configuration. In one of the containers there is a Tomcat server and it has some default .war file deployed in we

3条回答
  •  囚心锁ツ
    2021-01-07 17:46

    Since extend has been removed in version 3 there's a new way of overriding settings by providing multiple -f params where the next file extends the previous config

    The docs are mixed between versions https://docs.docker.com/compose/extends/#multiple-compose-files

    i.e. to run in development mode

    docker-compose -f docker-compose.yml -f docker-compose.dev.yml
    

    Where docker-compose.yml contains the full config and docker-compose.dev.yml only adds a volume

    services:
      serviceA:
        volumes:
          -.:/usr/local/abc/service
    

提交回复
热议问题