Docker 101 : One volume, multiple containers and the "--volumes-from -" option

Attaching a volume to multiple containers:

We start by running a container named "cont-one", using a debian image.
We also use a volume named "deb-vol", that would be mounted inside the container on the "/opt" directory.
After running the container, we create the file "file1" in it.

Below are our commands:

We create another container "cont-two", also based on a debian image, and we attach the storage of the container "cont-one" to the "/opt" directory on the container "cont-two".

Below are our commands:

We see from the output of the "ls" command above, that we have access to the file "file1" created in the container "cont-one".


Leave as a comment: