O'Reilly logo

Docker: Creating Structured Containers by Scott Gallagher, Allan Espinosa, Russ McKendrick, Santosh Kumar Konduri, Vaibhav Kohli, Rajdeep Dua, Neependra Khare, Oskar Hane, Shrikrishna Holla, Vinod Singh, Jeeva S. Chelladhurai, Pethuru Raj

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sharing data between containers

In the previous section, we learnt how seamlessly the Docker engine enables data sharing between the Docker host and the container. Even though it is a very effective solution, it tightly couples the container to the host filesystem. These directories might leave a nasty footprint because the user has to manually remove them once their purpose is met. So, the Docker's prescription to solve this issue is to create data-only containers as a base container, and then mount the Data Volume of that container to other containers using the --volume-from option of the docker run subcommand.

Data-only containers

The prime responsibility of a data-only container is to preserve the data. Creating a data-only container is very ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required