Docker Community Forums

Share and learn in the Docker community.

Mounting volume from one container to another

(Nippysaurusu) #1

Basically I have a long running container which downloads files (a whole directory of them) from the internet and mounts them in another (short lived) container for some processing to be done.

It needs to be done this way because processing the files actually executes them, so this is a security consideration.

It should also be noted that each of these containers are running on a different host.

The problem is that when I mount the directory on the second container I can not see all of its contents. The root directory and one of the sub directories seem to show up but none of the files.

I tried mounting a directory from the host for the first container to use for storage (so its not using tmpfs) but that didn’t seem to help at all.

Does anyone have any experience doing this or have any guidance?

I’ve been using docker for a few months now but am not too familiar with many of the advanced features.

I would really appreciate any feedback or assistance :slight_smile: Thank you :slight_smile:

(Jeanepaul) #2


you could try --volumes-from

long running container
$ docker create -v /dbdata --name dbdata awesome_container

then link that to short lived container
$ docker run -d --volumes-from dbdata --name db1 short_lived

more from here

(Nippysaurusu) #3

As far as I know that will not because they are running on different hosts?