Skip to main content
All volumes are stored in /var/lib/docker/volumes and are mounted as read-write by default.
Docker volume is used to persist and share container data across containers. Folders on your host machine’s hard drive are mounted into containers as volumes, allowing the container to write data into the host volumes.

Volume Types

Anonymous volumes only exist as long as the container exists. They are automatically created and removed with the container. Bind mounts can prevent certain files from being overlapped.
docker run -v /app/logs <image>

Volume Operations

List volumes

docker volume ls

Create a volume

docker volume create <volume-name>

Inspect a volume

docker volume inspect <volume-name>

Remove a volume

docker volume rm <volume-name>
docker volume remove <volume-name>
docker volume prune  # remove all unused volumes

Build docs developers (and LLMs) love