Podman is a daemonless, rootless container engine that provides a Docker-compatible CLI without requiring a background daemon process. Developed by Red Hat, Podman runs containers as regular user processes, improving security. It supports pods (groups of containers sharing namespaces), making it a bridge between Docker and Kubernetes. This guide covers using Podman as a Docker replacement.
Installation
sudo apt install podman # Ubuntu 22.04+
sudo dnf install podman # Fedora/RHEL/Rocky
# Verify
podman --version
podman info
Docker Compatibility
# Podman is command-compatible with Docker
alias docker=podman # Drop-in replacement
podman pull nginx
podman run -d --name web -p 8080:80 nginx
podman ps
podman logs web
podman stop web
podman rm web
# Build images
podman build -t myapp .
podman push myapp registry.example.com/myapp
Rootless by Default
# Podman runs rootless out of the box — no daemon, no root required
podman run -d --name web -p 8080:80 nginx
# This runs as your user, not root
# Check user namespace mapping
podman unshare cat /proc/self/uid_map
Pods (Kubernetes-Like Grouping)
# Create a pod (shared network namespace)
podman pod create --name myapp -p 8080:80
# Add containers to the pod
podman run -d --pod myapp --name web nginx
podman run -d --pod myapp --name api node-app
# web and api share localhost — api can reach web at localhost:80
# List pods
podman pod ls
podman pod inspect myapp
# Generate Kubernetes YAML from a pod
podman generate kube myapp > myapp-k8s.yaml
# Deploy Kubernetes YAML with Podman
podman play kube myapp-k8s.yaml
Podman Compose
# Install podman-compose
pip install podman-compose
# Use existing docker-compose.yml files
podman-compose up -d
podman-compose ps
podman-compose down
# Or use Docker Compose directly with Podman socket
systemctl --user start podman.socket
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock
docker compose up -d # Uses Podman backend
Systemd Integration
# Generate systemd unit file from running container
podman generate systemd --new --name web > ~/.config/systemd/user/container-web.service
# Enable and manage
systemctl --user daemon-reload
systemctl --user enable --now container-web
# Quadlet (Podman 4.4+) — declarative container management
# ~/.config/containers/systemd/web.container
[Container]
Image=nginx:latest
PublishPort=8080:80
Volume=web-data:/usr/share/nginx/html
[Service]
Restart=always
[Install]
WantedBy=default.target
Best Practices
- Use Podman as a drop-in Docker replacement for development and single-host production
- Leverage pods for multi-container applications that share networking
- Use
podman generate kubeto create Kubernetes manifests from running pods - Use Quadlet files for systemd-managed containers in production
- Enable the Podman socket for Docker Compose compatibility