podman volume: Manage Data Volumes
podman volume manages named volumes that persist data independently of any single container.
Named volumes hold data that should outlive a container, like a database in an integration test. podman volume mirrors docker volume.
What it does
podman volume creates, lists, inspects, and removes named volumes. A volume is storage managed by Podman that you mount into containers with -v name:/path, surviving container removal until you delete the volume.
Common usage
podman volume create pgdata
podman run -d -v pgdata:/var/lib/postgresql/data docker.io/library/postgres:16
podman volume ls
podman volume inspect pgdata
podman volume rm pgdata
podman volume prune -fOptions
| Command/Flag | What it does |
|---|---|
| create <name> | Create a named volume |
| ls | List volumes |
| inspect <name> | Show volume metadata, including mountpoint |
| rm <name> | Remove a volume |
| prune -f | Remove all unused volumes |
| -v name:/path:Z | Mount a volume (with SELinux relabel) |
In CI
Use a named volume for test data that must persist across container restarts within a job, and podman volume prune -f in cleanup to reclaim space. On SELinux runners add :Z to the volume mount so the container can write to it.
Common errors in CI
"Error: volume ... is being used by the following container(s)" on rm means a container still mounts it; remove the container first or use podman volume rm -f. "Permission denied" writing into a mounted volume on an SELinux host is fixed with the :Z mount option. A volume created by another user is invisible due to the rootless-vs-root store split.