Mastering Podman's basic container management commands: pull, run, ps, logs, exec, inspect, stop, rm, and stats, understanding the container lifecycle from create to restart, reading exit codes, and cleaning up leftover containers with prune.

In episode 2 you understood the architecture: no daemon, fork/exec, and its ecosystem. Episode 3 puts the tools in your hands — all the basic commands you'll use every day to manage containers. You'll run images, peek at processes and logs, get inside containers, stop and remove them, and clean up leftovers that are no longer used.
Podman's core commands can be grouped by what they do:
| Command | Function |
|---|---|
podman run | Runs a new container from an image |
podman pull | Downloads an image from a registry |
podman ps | Lists running containers |
podman logs | Shows container logs |
podman exec | Runs a command inside a running container |
podman inspect | Shows detailed metadata of a container or image |
podman stop | Stops a container |
podman rm | Removes a container |
podman stats | Shows container resource usage |
podman info | Shows runtime environment information |
Let's start with pulling an image and running your first container:
podman pull nginx:latest
podman run -d --name web -p 8080:80 nginx:latestpodman pull fetches the image into local storage; podman run -d --name web -p 8080:80 nginx:latest creates a container named web, runs it in the background, and maps host port 8080 to container port 80.
To see what's running and peek inside:
podman ps
podman ps -a
podman logs web
podman stats
podman exec -it web bashpodman ps lists currently active containers. Add -a to include stopped containers — useful when tracking down a container that failed. podman logs opens the container log, podman stats monitors CPU and memory usage, and podman exec -it web bash opens an interactive shell inside the container to check its internal state.
When you need details that don't show up in podman ps — like mounts, environment variables, or status — use inspect:
podman inspect webThe output is a full JSON document. You can extract a single section with podman inspect --format and a Go template expression, or simply search for a keyword in the output. podman inspect also works on images, making it a good source of truth when dissecting both containers and images.
Containers have a clear lifecycle, and Podman provides commands for each stage:
| State | Command | Description |
|---|---|---|
| Created | podman create | Container is created but not yet run |
| Running | podman start | Starts a container that was already created |
| Running | podman restart | Stops then starts again |
| Stopped | podman stop | Stops gracefully |
| Removed | podman rm | Removes the container along with its files |
Note the difference between run and create: run combines create and start in one step, while create only prepares the container. The create-then-start pattern is useful when you want to prepare a container in advance, for example to turn it into a systemd unit in later episodes.
Two closing commands often used together:
podman stop web
podman rm web
podman stop -t 10 webpodman stop sends a stop signal and waits for the process to stop gracefully. The -t 10 flag sets a 10-second timeout before it's forced. podman rm then removes the container along with its files; for a running container, add -f so it gets stopped first and then removed.
Every time a container stops, it leaves behind an exit code. Podman forwards that code to your shell:
| Exit Code | Meaning |
|---|---|
| 0 | The process succeeded |
| 125 | General failure on the Podman side |
| 126 | The command inside the container could not be executed |
| 127 | The command was not found |
| Others | The exit code of the process run inside the container |
podman run --rm nginx:latest nginx -t
echo $?podman run --rm automatically removes the container after it stops — handy for one-off runs. The echo line at the end of the block above displays the exit code of the previous command, which you can use as a success indicator inside scripts.
Stopped containers don't disappear — they pile up and take space. To clean them up:
podman container prune
podman system prunepodman container prune removes all stopped containers; podman system prune cleans up more broadly — including unused images and build cache. Run it carefully, because there's no undo.
Caution
podman system prune removes stopped containers and untagged images. Make sure nothing you still need is among them before running it, or use the --filter flag to narrow the scope.
Tip
Get into the habit of naming containers with --name like podman run --name web. Names are far easier to read than a string of random IDs in ps, logs, and inspect — and they prevent you from targeting the wrong container when many are running.
Episode 3 builds your muscle memory: starting with pull and run, monitoring with ps, logs, and stats, peeking in via exec, dissecting metadata with inspect, stopping with stop and removing with rm, all the way to understanding exit codes and cleaning up leftovers with prune.
The key points to take home:
podman system prune keeps storage clean.podman inspect is the source of truth for container metadata.The next episode, Episode 4, focuses on the image side: pulling and pushing images, tagging, saving and loading as files, unpacking layers, and multi-architecture manifests.