Pcornel
Linux · Containers

Volumes

Cheat sheet · https://pcornel.dk/topic.php?topic=2893

Back to the Topic

Answer

Volumes keep container data outside the container's writable layer: named volumes (managed by Docker) and bind mounts (host paths).

Remember

Data in the container layer is lost on removal. Bind mounts need host permissions matching the container user and, on SELinux hosts, :z/:Z labels. Back up volumes.

First checks

  • docker ps -a / podman ps -a — containers and state
  • docker logs <c> — container output
  • docker inspect <c> — configuration, mounts, network
  • docker info — engine, storage driver, cgroup version

Commands

docker volume prune

Verify in this order

volume or host path → mounted into the container → app writes there → survives container removal

Where it usually breaks

First mismatch in hardware/kernel capability → scheduler/mm/device → cgroup/namespace → process/thread → service/runtime → workload behavior/counters; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2893

Confirmation

Confirm action

Continue?