Docker Volumes and Networks
Learn what storage mechanism Docker provides and how the Docker network allows containers to communicate.
Volumes
Containers do not retain state between restarts. This is generally a good thing. Any number of containers can be started from the same base image and each can handle incoming requests regardless of how or when they were launched.
However, some containers, such as databases, absolutely must retain data. So Docker provides two storage mechanism types:
- Volumes: a Docker-managed file system
- Bind mounts: a file or directory on the host machine
Either can map to a directory on the container, such as /data/db
for MongoDB storage.
Volumes are the ...