CertGrid CertGrid

Podman command cheat sheet

A searchable reference for the Podman commands you actually reach for, including the pod and Kubernetes subcommands Docker has no equivalent of. Every row with a Play example was executed on Ubuntu 26.04 with Podman 5.7.0.

Version, info and disk

  • podman --version

    Client version. There is no server to ask, so this is the whole answer.

    Full guide
  • podman info

    Everything about the local engine: runtime, network backend, store, rootless state.

  • podman info --format '{{.Host.OCIRuntime.Name}}'

    One field from info. The runtime, network backend and rootless flag are the three worth knowing by heart.

    Full guide
  • podman info --format '{{.Store.GraphRoot}}'

    Where images live. Under your home when rootless, /var/lib when not - the fastest way to tell which Podman you are talking to.

    Full guide
  • podman system df

    Disk used by images, containers and volumes, and how much is reclaimable.

  • podman system migrate Caution

    Rebuild the user namespace configuration after changing /etc/subuid or /etc/subgid.

    Does not remove images. Needed because the mapping is cached in the store.

  • podman system reset Destructive

    Delete every container, image, volume and network for this user.

    Deliberately not executed for this sheet.

Images

  • podman images

    List local images.

  • podman images --format 'table {{.Repository}} {{.Tag}} {{.Size}}'

    Just the columns you wanted.

  • podman pull docker.io/library/alpine

    Fetch an image. Write the registry out - Podman does not assume Docker Hub.

    A bare `alpine` needs unqualified-search-registries configured, or it asks a question it cannot ask in a script.

  • podman image inspect alpine --format '{{.Digest}}'

    The immutable digest. Pin this, not the tag, when it has to be the same image tomorrow.

  • podman image tree alpine

    Layers of an image and which other images share them.

  • podman tag SRC registry.example.com/team/app:1.4

    Add a second name to an existing image. Costs nothing - a tag is a pointer.

  • podman push registry.example.com/team/app:1.4

    Upload. Needs `podman login` first unless the registry is open.

  • podman save -o app.tar app:1.4

    Write an image to a tar file, for moving it without a registry.

  • podman load -i app.tar

    Read one back in.

  • podman rmi IMAGE Caution

    Remove an image.

    Fails while a container still references it; add -f to remove both.

Running containers

  • podman run -d --name web -p 8080:80 docker.io/library/nginx:alpine

    Detached, named, with a published port. The everyday form.

  • podman run --rm -it docker.io/library/alpine sh

    Interactive shell that cleans up on exit.

  • podman run --rm docker.io/library/alpine id

    One command, then gone. Note the uid: root inside is you outside.

    Full guide
  • podman ps

    Running containers.

  • podman ps -a --pod

    Everything, including stopped containers and which pod each is in.

    Full guide
  • podman ps --format 'table {{.Names}} {{.Status}} {{.Ports}}'

    The three columns that answer most questions.

  • podman stop web

    SIGTERM, then SIGKILL after 10 seconds.

    If it always takes 10 seconds, the process is not handling SIGTERM as PID 1.

  • podman restart web

    Stop and start, keeping the container.

  • podman rm web Caution

    Remove a stopped container.

  • podman start -a web

    Start a stopped container and attach to its output.

Inspecting a running container

  • podman inspect web --format '{{.State.Pid}}'

    The host PID of the container's process, which is what ps needs.

    IPAddress is EMPTY for a rootless container on the default network - pasta gives it the host's interface rather than a bridge address.

  • podman logs --tail 20 -f web

    Recent output, then follow.

  • podman exec -it web sh

    A shell inside a running container.

  • podman exec web nginx -v

    One command inside, no shell.

  • podman top web pid user comm

    Processes as the container sees them - PID 1 is its entrypoint.

    Full guide
  • podman stats --no-stream

    CPU and memory once, rather than a live display.

  • podman diff web

    What the container changed relative to its image. A for added, C for changed.

  • podman port web

    Published ports for this container.

    Full guide
  • podman healthcheck run web

    Run the container's health check once and print the result, instead of waiting for the interval.

    Full guide

Pods

  • podman pod create --name app -p 8080:80

    Create a pod. Ports go HERE, not on the containers.

    Full guide
  • podman pod ps

    Pods, with a container count that includes the infra container.

    Full guide
  • podman run -d --pod app --name web docker.io/library/nginx:alpine

    Add a container to an existing pod.

    Adding -p here fails: network configuration belongs to the pod.

  • podman pod inspect app --format '{{.SharedNamespaces}}'

    Which namespaces the pod shares. The answer is uts, ipc and net - not pid, not mnt.

    Full guide
  • podman pod stop app

    Stop every container in the pod.

  • podman pod rm -f app Caution

    Remove a pod and its containers. Quieter than kube down.

    Full guide
  • podman pod create --share pid,uts,ipc,net

    Share the PID namespace too, so containers can see each other's processes.

    Be deliberate: it also lets one container signal another's processes.

Kubernetes YAML

  • podman kube generate app

    Export a running pod as a Kubernetes manifest.

    Full guide
  • podman kube generate app -f app.yaml

    Same, written to a file.

  • podman kube generate --type deployment app

    Wrap the pod spec in a Deployment instead of a bare Pod.

  • podman kube play app.yaml

    Run a manifest with no cluster. Container names come back prefixed with the pod name.

    Full guide
  • podman kube play --replace app.yaml

    Tear down and recreate in one step, instead of failing on an existing pod.

  • podman kube down app.yaml Caution

    Remove what a manifest created.

    Prints a rootless netns error and exits 0 anyway. Check $?, not the text.

    Full guide
  • podman kube play dep.yaml

    A Deployment plays, but replicas above 1 are reduced to 1 with a warning - Podman is not a scheduler.

    Full guide
  • podman kube play svc.yaml

    Service and StatefulSet are refused by name. Supported kinds: Pod, Deployment, DaemonSet, Job, PVC, ConfigMap, Secret.

    Full guide

Networks

  • podman network ls

    Networks, including any created by kube play.

  • podman network inspect podman --format '{{.Subnet}}'

    The default bridge subnet, which is 10.88.0.0/16 rather than Docker's 172.17.

  • podman network create appnet

    A user-defined network, which gets container name resolution via aardvark-dns.

  • podman run --network appnet ...

    Attach a container to it. On a user-defined network, containers resolve each other by name.

  • podman network rm appnet Caution

    Remove it.

  • sudo sysctl net.ipv4.ip_unprivileged_port_start=80 Caution

    Allow a rootless container to publish a port below 1024.

    Host-wide, and it lets any unprivileged process bind those ports.

Volumes and mounts

  • podman volume create data

    A named volume.

  • podman volume ls

    List volumes.

  • podman volume inspect data --format '{{.Mountpoint}}'

    Where it actually is on disk - under your home when rootless.

  • podman run -v data:/var/lib/app ...

    Mount a named volume.

  • podman run -v ~/src:/src ...

    Bind mount a host directory.

    Files the container's root writes land owned by YOUR uid outside.

    Full guide
  • podman run --userns=keep-id -v ~/src:/src ...

    Map your uid to the same uid inside, so a non-root container process can write to your files.

  • podman unshare rm -rf ./dir Destructive

    Delete files owned by a subordinate uid, from inside the namespace where you own them.

  • podman volume rm data Destructive

    Remove a volume and its contents.

Building

  • podman build -t app:1.4 .

    Build from a Containerfile, or a Dockerfile if that is what is there.

    This is a front end to buildah.

  • podman build --no-cache -t app:1.4 .

    Ignore cached layers.

  • podman build --target builder -t app:build .

    Stop at one stage of a multi-stage build.

  • podman build --platform linux/arm64 -t app:arm .

    Build for another architecture, given emulation.

  • buildah from docker.io/library/alpine

    Start a working container to build up by hand, with no Containerfile.

Systemd and Quadlet

  • systemctl --user enable --now podman.socket

    Serve the Docker-compatible API, which is what real docker-compose needs.

    Full guide
  • export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock

    Point Docker tooling at that socket.

  • loginctl enable-linger $USER

    Keep your user's systemd instance running after logout, so rootless services survive it.

    Without this, a rootless container started as a user service stops when your last session ends.

  • systemctl --user daemon-reload

    Regenerate units after adding a Quadlet file.

  • podman auto-update Caution

    Pull newer images for containers labelled io.containers.autoupdate=registry and restart them.

Cleanup

  • podman system prune -f Caution

    Remove stopped containers, unused networks and dangling images.

  • podman system prune -a --volumes -f Destructive

    The same, plus every unused image and volume.

    --volumes is the part that loses data. Check `podman volume ls` first.

  • podman container prune -f Caution

    Stopped containers only.

  • podman image prune -f Caution

    Dangling images only.

When something is wrong

  • podman events --since 10m --stream=false

    One timeline of creates, starts, deaths and pulls. The first place to look when something restarted and you do not know why.

  • podman inspect web --format '{{.State.ExitCode}} {{.State.Error}}'

    Why a container stopped.

  • pgrep -a conmon

    One monitor process per running container. No conmon, no container.

    Full guide
  • pstree -sp $(pgrep conmon | head -1)

    Proof there is no daemon: conmon's parent is PID 1.

    Full guide
  • podman logs --since 5m web

    Recent output only.

  • podman run --log-level debug ...

    Verbose engine logging for a single command.

  • hash -r

    Clear the shell's cached command lookups, when podman was just installed and 'command not found' persists.

    Full guide