Docker volumes

Updated: 01 July 2024

  • Volumes can be shared among multiple containers.
  • Volumes work on both Linux and Windows containers.
  • Volume drivers let you store volumes on remote hosts

List all docker volumes

docker volume ls

Inspect a volume

docker volume inspect my-vol
        "Driver": "local",
        "Labels": {},
        "Mountpoint": "/var/lib/docker/volumes/my-vol/_data",
        "Name": "my-vol",
        "Options": {},
        "Scope": "local"

Delete a volume

docker volume rm my-vol

Delete all volumes

docker volume rm $(docker volume ls -q)

List volumes for a container

docker inspect -f '{{ .Mounts }}' containerid

Remove local and anonymous volumes not referenced by any containers

docker volume prune