Is it possible to mount /foo from the root filesystem as read-only and not propagate changes into a docker container? For example if /foo contains bar, I create a container, then later on I create /foo/baz, I do not want /foo/baz to appear in the container.
Asked
Active
Viewed 135 times
0
-
As long as you're mounted to something in the root filesystem the changes will be reflected in the container. Why would you not want to see the changes? – Jay Blanchard Oct 29 '20 at 12:33
-
A little searching revealed this though - https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder – Jay Blanchard Oct 29 '20 at 12:36
-
That sounds like you want to `COPY` that code into your image, and then let the normal container filesystem mechanics work; that's different from how bind mounts work. – David Maze Oct 29 '20 at 12:56
-
@JayBlanchard I'll elaborate a little more. I'm trying to start a container runner drone. I want to mount a directory containing the latest compiled code then do build checks on a pull request. There could be multiple containers running at the same time. Once a pull request is merged I want to update the base image. I don't want the update to interfere with containers already running. – EncryptedWatermelon Oct 29 '20 at 13:18