Sharing data between containers
In the previous section, you learned how seamlessly the Docker Engine enables data sharing between the Docker host and the container. Although it is a very effective solution for most of the use cases, there are use cases wherein you will have to share data between one or more containers. The Docker's prescription to address this use case is to mount the data volume of one container to other containers using the --volume-from
option of the docker run
subcommand.
Data-only containers
Before Docker introduced the top-level volume management feature, the data-only container was the recommended approach to achieve data persistency. It is worth understanding data-only containers because you will find many implementations that are based on 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...