liveBook · Manning

Volume

As explained in Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more

A volume is persistent or separately managed storage that can be associated with a container.

A volume is storage mounted into a container and managed separately from its application image. Separating data avoids embedding environment-specific content, supports reuse, and can improve read/write performance by avoiding layered filesystems. section 3.0 section 3.1.3

Podman supports several practical volume workflows:

  • Bind mounts expose an existing host file or directory through -v HOST-DIR:CONTAINER-DIR; changes are visible on both sides. section 3.1
  • Named volumes are created with podman volume create, stored under container storage by default, reusable across containers, and retained after container removal. section 3.1.1
  • The --mount option passes Linux mount options through Podman and supports bind, volume, image, tmpfs, and devpts types. section 3.1.3
  • Volume commands create, inspect, list, export, import, prune, test existence, and remove volumes. section 3.1.1 section 3.1.3

Read-only bind mount

Create host content and mount it into a web container with SELinux labeling: podman run -d -v ./html:/var/www/html:ro,z -p 8080:8080 quay.io/rhatdan/myimage. The container can read the files, while host processes can still modify them; removing the container leaves the host directory intact. section 3.1

Named volume inspection

Create and inspect persistent storage with podman volume create webdata and podman volume inspect webdata, then mount it using -v webdata:/var/www/html:ro,z. Remove it explicitly with podman volume rm --force webdata when its data is no longer needed. section 3.1.1

Table 3.2 Podman volume commands (view table figure)

Command

Man page

Description

create

podman-volume-create(1)

Create a new volume.

exists

podman-volume-exists(1)

Check if a volume exists.

export

podman-volume-export(1)

Export the contents of a volume into a tar ball.

import

podman-volume-import(1)

Untar a tarball into a volume.

inspect

podman-volume-inspect(1)

Display detailed information on a volume.

list

podman-volume-list(1)

List all of the volumes.

prune

podman-volume-prune(1)

Remove all unused volumes.

rm

podman-volume-rm(1)

Remove one or more volumes.

Use the command table to navigate Podman volume lifecycle operations, including creation, inspection, archival, cleanup, and removal. section 3.1.3

How Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more covers it

How deep it goes
Explains bind mounts, named volumes, storage paths, mount types, lifecycle commands, and security adjustments, while only briefly noting plugins.
Examples
Demonstrates read-only web-content bind mounts, named-volume inspection, browser verification, and volume cleanup commands.
What it assumes
Assumes container images and basic host filesystem operations, while introducing bind mounts, named volumes, SELinux labeling, and user-namespace implications.
What you can do after
Operate/configure Podman volumes with -v, --mount, volume inspection, archival, and cleanup commands.
How it connects
Connects volumes to container images, bind mounts, Linux mount commands, copy-on-write filesystems, SELinux, and user namespaces.

Also explained in

Compare how 8 books explain volume →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Podman in Action: Secure, rootless containers for Kubernetes, microservices, and more. The section links point to the parts of the book it draws on.