This chapter introduces data volumes and storage driver concepts, which are widely used in Docker to manage persistent or shared data. We'll be also taking a deep dive into various storage drivers supported by Docker, and the basic commands associated with them for management. The three main use cases for Docker data volumes are as follows:
To keep data persistent after a container is deleted
To share data between the host and the Docker container
To share data across Docker containers
In order to understand a Docker volume, we need to understand how the Docker filesystem works. Docker images are stored as a series of read-only layers. When the container is started, the read-only image adds a read-write layer on top. If the current file needs to be modified, it is copied from the read-only layer to the read-write layer, where changes are applied. The version of the file in the read-write layer hides the underlying file but doesn't destroy it. Thus, when a Docker...