How to mount a single file in a volume

后端 未结 14 1106
隐瞒了意图╮
隐瞒了意图╮ 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 10:45

    For anyone using Windows container like me, know that you CANNOT bind or mount single files using windows container.

    The following examples will fail when using Windows-based containers, as the destination of a volume or bind mount inside the container must be one of: a non-existing or empty directory; or a drive other than C:. Further, the source of a bind mount must be a local directory, not a file.

    net use z: \\remotemachine\share

    docker run -v z:\foo:c:\dest ...

    docker run -v \\uncpath\to\directory:c:\dest ...

    docker run -v c:\foo\somefile.txt:c:\dest ...

    docker run -v c:\foo:c: ...

    docker run -v c:\foo:c:\existing-directory-with-contents ...

    It's hard to spot but it's there

    Link to the Github issue regarding mapping files into Windows container

提交回复
热议问题