Docker Volumes
Learn how Docker volumes keep data beyond the life of a container, when to use named volumes versus bind mounts, and how to inspect and clean up storage safely.
Containers are designed to be replaceable, which is great for reliability but dangerous for data. If you write files only inside a container filesystem, those files disappear when the container is removed. Docker volumes solve that problem by letting you store important data outside the container lifecycle.
This section focuses on the three ideas every beginner needs first: named volumes for Docker-managed persistent data, bind mounts for mapping host files into containers, and volume management for inspecting, cleaning up, backing up, and restoring stored data.
Named volumes are usually the best choice for databases, uploads, and application data that should survive container restarts and container deletion. Docker manages where the data lives, which makes named volumes portable and easy to reuse across containers.
Bind mounts are different. They connect a specific file or directory from your host machine directly into the container. That makes them ideal for local development, live reload workflows, configuration injection, and log collection, but they also come with more security and path-management responsibility.
Once you start using either approach, day-to-day operations matter too. You need to list volumes, inspect them, remove unused ones, and sometimes back them up before migration or cleanup.
Use the sub-pages below to learn each storage pattern in depth.
| Topic | What you will learn | Link |
|---|---|---|
| Named Volumes | Create Docker-managed persistent storage, mount it into containers, and share data safely. | Open sub-page |
| Bind Mounts | Map host files and folders into containers for local development and configuration workflows. | Open sub-page |
| Volume Management | List, inspect, prune, back up, and restore volumes for everyday Docker operations. | Open sub-page |