2.1.1.4 Daemon Volume Control
A focused guide to Daemon Volume Control, connecting core concepts with practical Docker and container operations.
Daemon volume control is the daemon's responsibility for creating, attaching, and managing persistent storage that outlives an individual container, allowing data to survive container restarts, recreation, or replacement.
Why Container Filesystems Alone Are Not Enough
A container's own filesystem is tied to its lifecycle — when a container is removed, its filesystem and any data written to it disappear with it. Applications that need data to persist beyond a single container's life, such as a database, need storage managed separately from the container itself.
docker volume create myapp-data
docker run -d --name db -v myapp-data:/var/lib/postgresql/data postgres:16
The named volume myapp-data exists independently of the db container; removing the container does not remove the volume or the data inside it.
Volume Lifecycle Managed by the Daemon
The daemon tracks every volume it creates, where its data is actually stored on the host filesystem, and which containers currently have it mounted, exposing this information through inspection commands.
docker volume ls
docker volume inspect myapp-data
Reattaching Volumes to New Containers
Because the daemon manages volumes independently of any specific container, a new container can be started with the same volume attached, picking up exactly where a previous, now-removed container left off.
docker rm -f db
docker run -d --name db -v myapp-data:/var/lib/postgresql/data postgres:16
The new db container has access to the same data the original container wrote, because the volume itself was never removed.
Bind Mounts as an Alternative
The daemon also supports bind mounts, which map a specific path on the host directly into a container, useful for development workflows where local source code needs to be visible inside a running container.
docker run -v "$(pwd)":/app myapp:dev
Removing Volumes Deliberately
Because volumes persist independently of containers, they must be removed deliberately; simply removing every container that used them does not automatically delete the underlying data.
docker volume rm myapp-data
Why Daemon-Managed Volumes Matter
Centralizing volume management in the daemon means persistent data has a lifecycle controlled explicitly, separate from the otherwise disposable nature of containers — which is precisely what allows containers to be freely replaced without risking the data that matters.