Managing Data in Docker
The following is an overview of how Docker's storage system works, based on Manage Data in Docker.
How Data Works in Containers
The Host File System refers to the file system of the operating system that is running the container. The Host can access the physical storage devices on the computer. If you are using a machine running Windows, that is the Host OS, and the file system you access through Windows is the Host File System.
When a Docker container is running, it includes its own tiny Linux OS. The file system of that tiny virtual Linux OS is known as the Container File System. As programs are running in the container, they can save data to the Container File System.
However, it is important to remember that, by default, when Docker containers are shut down the tiny OS running in that container is wiped clean, and all data in the Container File System is lost. This means that in order to persist (keep) data after the container shuts down you need to save that data on the Host File System.
Mounting a Drive is a term that refers to mapping a directory of the Container File System to the Host File System.
There are three main types of mounts. Below is a diagram that you can reference as each type of mount is explained.
