How to mount a single file in a volume

后端 未结 14 1114
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 10:16

I am trying to dockerize a PHP application. In the dockerfile, I download the archive, extract it, etc.

Everything works fine. However, if a new version gets released

14条回答
  •  天涯浪人
    2020-11-27 10:40

    The way that worked for me is to use a bind mount

      version: "3.7"    
      services:
      app:
        image: app:latest
        volumes:
          - type: bind
            source: ./sourceFile.yaml
            target: /location/targetFile.yaml
    

    Thanks mike breed for the answer over at: Mount single file from volume using docker-compose

    You need to use the "long syntax" to express a bind mount using the volumes key: https://docs.docker.com/compose/compose-file/#long-syntax-3

提交回复
热议问题