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 [COMMAND]
PARAMETERS
create
Create a volume.
inspect
Display detailed information on one or more volumes.
ls
List volumes.
prune
Remove all unused local volumes.
rm
Remove one or more volumes.
DESCRIPTION
The `docker volume` command provides a way to manage persistent data storage for Docker containers directly from the command line interface. Docker volumes are preferred mechanisms for persisting data generated by and used by Docker containers. They exist independently of the container lifecycle, meaning data isn't deleted when a container is removed. This command allows users to create, list, inspect, prune, and remove volumes, providing granular control over their data management strategy. It's crucial for managing persistent application data, sharing data between containers, and backing up data outside of the container environment. By using volumes, you improve the portability and maintainability of your applications by separating the data from the container's filesystem. The Docker volume commands are designed to work seamlessly with Docker Engine and Docker Compose, enabling the creation of more robust and scalable applications.
VOLUME DRIVERS
Docker supports various volume drivers, including local, NFS, and cloud-based storage solutions. The driver can be specified during volume creation using the `--driver` flag. Example: `docker volume create --driver local --opt type=nfs --opt o=addr=192.168.1.1,rw volume_name`
MOUNTING VOLUMES
Volumes are mounted to containers using the `-v` or `--mount` flags in the `docker run` command. Example: `docker run -v myvolume:/data myimage`. The `--mount` flag offers more advanced options such as specifying propagation modes (e.g., `rprivate`, `shared`).
VOLUME PERMISSIONS
File permissions inside volumes are typically managed within the container's filesystem. Users should ensure the correct permissions are set so that applications within the container can read and write to the mounted volume.
SEE ALSO
docker(1), docker-container(1)