Skip to content

Docker & Podman: Podman

Podman commands from the Docker & Podman folder.

Index
6 items

Podman: List all containers

Safe

Running and exited containers, rootless by default for the current user.

podman ps -a
What each part does
  1. podman pslist containers
  2. -ainclude stopped ones

Also known as: podman ps

Podman: Follow logs of a container

Safe

Stream a container's output starting from the last 200 lines.

podman logs -f --tail 200 <container>
What each part does
  1. podman logsshow a container's output
  2. -ffollow new lines
  3. --tail 200start with the last 200 lines
  4. <container>container name or ID

Also known as: podman logs

Podman: Create a pod with a published port

Safe

A pod shares one network namespace between containers, like a Kubernetes pod. Add containers with --pod <pod>.

podman pod create --name <pod> -p <host-port>:<container-port>
What each part does
  1. podman pod createcreate a pod: containers in it share network and localhost
  2. --name <pod>the pod's name
  3. -p <host-port>:<container-port>publish a port; must be set on the pod, not on its containers

Also known as: podman pod

Podman: Generate a systemd unit for a container

Safe

Writes container-<name>.service so systemd can manage the container.

podman generate systemd --new --files --name <container>
What each part does
  1. podman generate systemdwrite a systemd unit for a container (newer Podman prefers Quadlet files)
  2. --newthe unit creates a fresh container on start and removes it on stop
  3. --fileswrite .service files to the current directory instead of stdout
  4. --name <container>use the container name (not ID) in the unit

My note Deprecated in favour of Quadlet (.container files in ~/.config/containers/systemd/) on Podman 4.4+.

Also known as: podman systemd · quadlet

Podman: Log in to a registry

Safe

Store registry credentials for pulls and pushes (auth.json).

podman login <registry> -u <username>
What each part does
  1. podman login <registry>authenticate to a registry, e.g. quay.io
  2. -u <username>the user name; prompts for the password (or use --password-stdin)

Also known as: podman login · unauthorized

Podman: Prune everything unused

Destructive

Remove stopped containers, unused pods, images and build cache.

podman system prune -a -f
What each part does
  1. podman system pruneremove stopped containers, unused pods, networks and dangling images
  2. -aalso remove all images not used by a container
  3. -fdon't ask for confirmation

My note Add --volumes to delete unused volumes too.

Also known as: podman prune · no space left on device

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…