Home > Blockchain >  Does one docker container can access the /tmp folder of another container?
Does one docker container can access the /tmp folder of another container?

Time:04-19

We use docker containers as our Jenkins build slaves and per VM hosts 10 docker containers.

Question being, does /tmp folder of one container can be accessed by all other containers, will it interfere during the CI build execution ?

There is no special configuration that allows communication among containers but wanted to understand, is there any default settings that allows this feature ?

CodePudding user response:

Containers can't access other containers' file systems ever. You can't read or write files or run binaries from another container.

The only exception is if, at startup time, the same external content (either a host directory or a named volume) is mounted into multiple containers. This hides the content that's originally in their respective images in those directories and replaces them with the mounted content; it is not a (reliable) way to publish one image's content to another.

If you use Jenkins's docker.inside() call, the docker run command it generates has a very large number of options that do publish things like the current build directory into the container on the same path. Unless that includes a -v ...:/tmp option, the /tmp directory will be isolated to each container.

  • Related