Docker **volumes** are a way to **persist data** generated or used by [[- Docker -|Docker]] containers. They're used when you want to store data **outside the container's writable layer**, so it isn't lost when the container is stopped, deleted, or recreated.
---
- Stored on the host [[File Systems|file system]] (typically under `/var/lib/docker/volumes/`)
```bash
# Create a named volume
docker volume create my_volume # Creates a Docker-managed volume
# Run a container using the volume
docker run -d \
--name my_container \
-v my_volume:/app/data \ # Mounts volume to /app/data in the container
my_image
# Inspect the volume details (mount point, usage, etc.)
docker volume inspect my_volume
# List all volumes on the system
docker volume ls
# Remove a specific volume (only if not in use)
docker volume rm my_volume
# Remove all unused volumes
docker volume prune
```