docker-volume
Manage persistent data volumes with Docker
TLDR
Create a volume
Create a volume with a specific label
Create a tmpfs volume a size of 100 MiB and an uid of 1000
List all volumes
Remove a volume
Display information about a volume
Remove all unused local volumes
Display help for a subcommand
SYNOPSIS
docker volume create|inspect|ls|prune|rm [OPTIONS] [VOLUME...]
PARAMETERS
create
Create a new volume
inspect
Display detailed information on volumes
ls
List volumes
prune
Remove unused local volumes
rm
Remove one or more volumes
DESCRIPTION
The docker volume command manages named data volumes used by Docker containers for persistent storage. Volumes outlive containers, enabling data persistence across container recreations. Unlike bind mounts from host paths, volumes are fully managed by Docker, stored in /var/lib/docker/volumes/ by default on Linux hosts.
Key functionalities include creating volumes with custom drivers (e.g., local, nfs), listing volumes with filters, inspecting detailed metadata like mountpoints and driver status, pruning unused volumes to reclaim space, and removing specific volumes. Volumes support labels for metadata and driver-specific options.
Essential for stateful apps like databases (e.g., MySQL, PostgreSQL). Integrates with Docker Compose and Swarm for orchestrated deployments. Anonymous volumes (created via docker run -v) are listed but managed differently. Always stop dependent containers before rm/prune to avoid errors.
CAVEATS
Cannot remove volumes in use by running containers.
Prune skips volumes referenced by containers.
Default driver is 'local'; requires root for host mounts.
CREATE OPTIONS
--driver string (default: local)
-l, --label []
-o, --opt []
LS OPTIONS
-f, --filter [] (name, driver, label, dangling)
-q, --quiet
INSPECT OPTIONS
-f, --format string
-v, --verbose
PRUNE OPTIONS
-f, --force
--filter [] (label, until)
RM OPTIONS
-f, --force
HISTORY
Introduced in Docker 1.9.0 (Nov 2015) for improved volume management over bind mounts. Enhanced in later versions with drivers, labels, and prune (1.13+).
SEE ALSO
docker(1), docker-run(1), docker-compose(1), mount(8)


