Book Image

Learning Docker

By : Pethuru Raj, Jeeva S. Chelladhurai, Vinod Singh, Vinod kumar Singh, Jeeva Chelladhurai, Pethuru Raj Chelliah
Book Image

Learning Docker

By: Pethuru Raj, Jeeva S. Chelladhurai, Vinod Singh, Vinod kumar Singh, Jeeva Chelladhurai, Pethuru Raj Chelliah

Overview of this book

Table of Contents (18 chapters)
Learning Docker
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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 similar to the method illustrated in the data volume section. In addition, the containers are named explicitly for other containers to mount the data volume using the container's name. The container's data volumes are accessible from other containers...