Docker volumes

Updated: 10 March 2026

https://docs.docker.com/storage/volumes/

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

For a (docker compose) single file

services:
  web:
    volumes:
      - ./foo.conf:/etc/nginx/conf.d/foo.conf

List all docker volumes

docker volume ls

Inspect a volume

docker volume inspect my_vol

Delete a volume (first find correct name with docker volume ls)

docker volume rm vol_name

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

Leave a comment