Skip to main content

Podman

Podman is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System. It is used extensively on the Hypervisor.

Basic Commands

Run a Container

Runs a command in a new container.

podman run [options] <image>

Example:

podman run -d --name <container_name> -v "$(pwd)"/data:/usr/app/data/ -p 8080:8080 <image_name>

List Containers

Lists running containers. Add -a to list all containers (including stopped ones).

podman ps
podman ps -a

Stop a Container

Stops one or more running containers.

podman stop <container_id_or_name>

Remove a Container

Removes one or more containers.

podman rm <container_id_or_name>

Logs

Fetch the logs of a container.

podman logs <container_name>

Podman Compose

Podman can use podman-compose to run multi-container applications defined in a YAML file (similar to Docker Compose).

Start Services

podman-compose up -d

Stop Services

podman-compose down

Systemd Integration

Podman containers can be managed as systemd services.

Generate Systemd Unit

podman generate systemd --new --name <container_name> > ~/.config/containers/systemd/<container_name>.container

(Note: Quadlet is the modern way to do this, using .container files directly in ~/.config/containers/systemd/)

Reload Systemd (User)

systemctl --user daemon-reload

Start/Enable User Service

systemctl --user enable --now <service_name>