Podman Fundamentals
Podman is a daemonless, open-source container engine for Linux that manages containers and container images. Unlike Docker, Podman doesn't require a daemon running as superuser, making it a more secure and flexible alternative for modern container workloads.
What is Podman?โ
Podman (Pod Manager) is a container runtime developed by Red Hat that implements the Open Containers Initiative (OCI) standard. It provides drop-in compatibility with Docker while introducing significant architectural improvements.
Key definition: Podman is "a daemonless, open source, Linux native tool designed to make it easy to find, run, build, share and deploy applications using Open Containers Initiative (OCI) Containers and Container Images."
Podman vs Docker: Key Differencesโ
Architecture Comparisonโ
Docker Architecture:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Client (docker CLI) โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ (REST API)
โโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Docker Daemon (dockerd) โ runs as root โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Container Runtime (containerd) โ โ
โ โ - Container lifecycle management โ โ
โ โ - Process isolation โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Podman Architecture:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Podman CLI (runs as user โ no daemon required) โ
โ - Direct container management โ
โ - Communicates directly with libpod โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ libpod library (Podman runtime) โ
โ - Container lifecycle management โ
โ - OCI container runtime interaction โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ OCI Runtime (runc, crun) โ
โ - Actual container execution โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Major Differencesโ
| Feature | Docker | Podman |
|---|---|---|
| Architecture | Daemon-based (Docker daemon) | Daemonless (direct libpod) |
| Root requirement | Daemon runs as root | Rootless by default |
| Security | All operations require root | Per-user containers |
| Container children | Child processes of daemon | Durable, independent |
| Container format | Docker format | OCI standard (compatible with Docker) |
| Orchestration | Docker Swarm (maintenance mode) | Kubernetes-native |
| API | REST API over socket | REST API optional; native libpod |
| Pod support | Limited (via docker-compose) | First-class pods |
| Systemd integration | None | Native systemd integration |
Rootless Containersโ
What is Rootless?โ
Rootless containers run without requiring superuser (root) privileges. Processes inside rootless containers run under the user's UID, not root's UID (0).
Benefits:
- Enhanced security โ Even if a container escapes, the attacker has user privileges, not root
- UID namespace isolation โ Processes in containers appear as root inside (UID 0) but map to user outside
- Multi-tenancy โ Multiple users can safely run containers on the same system
- Reduced attack surface โ No daemon privilege escalation vector
How Rootless Worksโ
Podman uses Linux namespaces and user mapping:
Inside Container (as seen by processes)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PID 1 (appears as UID 0 โ root) โ
โ PID 2 (appears as UID 0 โ root) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ (user namespace mapping)
Outside Container (on host)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PID 12345 (UID 1000 โ alice) โ
โ PID 12346 (UID 1000 โ alice) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Rootless Setupโ
# Enable rootless mode for current user
podman system migrate
# Run rootless container
podman run -it alpine sh
# Verify rootless execution
podman run alpine id
# Output: uid=0(root) gid=0(root) groups=0(root)
# But on host, the process runs as current user
# Check user mapping
podman run alpine cat /proc/self/uid_map
# Shows 0 1000 65536 (maps container 0 to host 1000+)
Pods: Podman's Container Groupsโ
What is a Pod?โ
A pod is a collection of containers sharing network namespace and storage. This concept is borrowed directly from Kubernetes and enables multi-container applications.
Pod characteristics:
- Shared network namespace (same IP address, shared localhost)
- Optional shared storage volumes
- Multiple containers coordinated as a unit
- Optional shared IPC namespace
Pod vs Single Containerโ
Single container:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Container A โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ App Process (port 8080) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ Network: eth0 (172.17.0.2) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Pod with multiple containers:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Pod: web-app โ
โ Network: eth0 (172.17.0.2) โ SHARED โ
โ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โ โ Container: app โ โ Container: logs โ โ
โ โ Port 8080 โ โ Port 9090 โ โ
โ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โ
โ Both access localhost:8080 (same interface) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Pod Operationsโ
# Create a pod
podman pod create --name web-app -p 8080:8080
# Run container in pod
podman run -d --pod web-app nginx
podman run -d --pod web-app --name app-logger fluent-bit
# Pod status
podman pod ls
podman pod inspect web-app
# Stop all containers in pod
podman pod stop web-app
# Remove pod (removes all containers)
podman pod rm web-app
Pod Manifest (Pod Definition)โ
apiVersion: v1
kind: Pod
metadata:
name: web-app
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
- name: app
image: myapp:1.0
ports:
- containerPort: 8080
# All containers share network namespace
# They can communicate via localhost
Systemd Integrationโ
What is Systemd Integration?โ
Podman can generate and manage systemd service units, treating containers as first-class systemd services. Containers restart on reboot and follow standard systemd conventions.
Benefitsโ
- Persistence โ Containers survive system reboot
- Standard management โ Use
systemctlto manage containers - Logging integration โ Container logs appear in
journalctl - Dependency management โ Order service startup with
After=,Wants= - Resource limits โ Control CPU, memory via systemd directives
Generate Systemd Unitโ
# Create a container
podman run -d --name nginx -p 80:80 nginx
# Generate systemd unit file
podman generate systemd --name nginx > nginx.service
# Result (example):
cat nginx.service
# /etc/systemd/system/nginx.service
[Unit]
Description=Podman container-nginx
Documentation=man:podman-generate-systemd(1)
Wants=network-online.target
After=network-online.target
RequiresMuffins=podman.service
[Service]
Environment="PODMAN_SYSTEMD_UNIT=%n"
Restart=on-failure
ExecStart=/usr/bin/podman start -a nginx
ExecStop=/usr/bin/podman stop -t 10 nginx
Type=notify
NotifyAccess=main
[Install]
WantedBy=multi-user.target
Enable and Manageโ
# Copy unit to systemd directory
sudo cp nginx.service /etc/systemd/system/
# Reload systemd daemon
sudo systemctl daemon-reload
# Enable service (start on boot)
sudo systemctl enable nginx.service
# Start service
sudo systemctl start nginx
# Check status
systemctl status nginx
# View logs
journalctl -u nginx -f
# Stop service
sudo systemctl stop nginx
Buildah and Skopeo: Complementary Toolsโ
Buildah: Container Image Buildingโ
Buildah is a tool for building OCI-compliant container images. It provides lower-level control than Podman's build command.
# Build image with Buildah
buildah bud -t myapp:1.0 .
# Lower-level operations
ctr=$(buildah from alpine)
buildah run $ctr apk add --no-cache curl
buildah copy $ctr ./app /app
buildah entrypoint $ctr ["/app/start.sh"]
buildah commit $ctr myapp:1.0
Skopeo: Image Registry Operationsโ
Skopeo inspects and copies container images between registries without running a daemon.
# Inspect remote image
skopeo inspect docker://docker.io/library/nginx:latest
# Copy image between registries
skopeo copy docker://docker.io/library/nginx:latest \
docker://quay.io/myrepo/nginx:latest
# Delete image from registry
skopeo delete docker://quay.io/myrepo/nginx:latest
Tooling Relationshipโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Podman Ecosystem โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Podman โ Container runtime + management โ
โ Buildah โ Low-level image building โ
โ Skopeo โ Registry operations (no daemon) โ
โ Podman Compose โ Docker Compose compatibility โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Migration from Dockerโ
Command Compatibilityโ
Most Docker commands work 1:1 with Podman. The primary difference is the executable name.
Docker to Podman mapping:
# Basic equivalence
docker run โ podman run
docker build โ podman build
docker ps โ podman ps
docker images โ podman images
docker volume โ podman volume
docker network โ podman network
docker inspect โ podman inspect
docker exec โ podman exec
docker logs โ podman logs
Full CLI Compatibilityโ
# Alias for compatibility
alias docker=podman
# Or create symlink
ln -s $(which podman) /usr/bin/docker
Compose File Migrationโ
Docker Compose files work with Podman Compose:
# Install Podman Compose
pip install podman-compose
# Use like Docker Compose
podman-compose -f docker-compose.yml up
podman-compose -f docker-compose.yml down
# Or with Podman's native compose (requires Podman 4.0+)
podman compose -f docker-compose.yml up
Key Migration Considerationsโ
- Socket location โ Docker:
/var/run/docker.sock; Podman:/run/user/1000/podman/podman.sock(rootless) - Root vs rootless โ Docker runs all as root; Podman defaults to rootless
- Pod concept โ Docker has minimal pod support; Podman has native pod support
- Systemd โ Podman integrates seamlessly; Docker requires systemd service files
- Daemon โ Docker requires daemon; Podman is daemonless
Migration Checklistโ
- Install Podman
- Test basic container operations
- Verify image compatibility
- Test rootless containers
- Migrate docker-compose.yml files
- Update any socket/daemon references
- Configure systemd units for persistent containers
- Test pod functionality
- Update CI/CD pipelines
- Document team transition
Security in Podmanโ
Default Security Modelโ
Rootless Podman (Default)
โโโ User namespace isolation (UID mapping)
โโโ No escalation privilege by default
โโโ Per-user container isolation
โโโ Lower attack surface
Rootful Podman
โโโ Full root access inside container
โโโ SELinux integration available
โโโ More powerful but requires root
โโโ Use only when necessary
SELinux Integrationโ
Podman supports SELinux labels:
# Run container with SELinux labels
podman run -d --security-opt label=type:svirt_apache_t \
-p 80:80 nginx
# List available labels
semanage login -l
Exercisesโ
Exercise 1: Basic Podman Workflowโ
- Pull an image:
podman pull alpine - Run container interactively:
podman run -it alpine sh - List running containers:
podman ps - Stop container:
podman stop <container-id>
Exercise 2: Rootless Containersโ
- Enable rootless mode
- Run a container and verify it runs under your user UID
- Check process ownership on the host system
- Confirm containers don't require sudo
Exercise 3: Pod Managementโ
- Create a pod with multiple containers
- Verify containers can communicate via localhost
- Inspect the pod configuration
- Stop the entire pod with a single command
Exercise 4: Systemd Integrationโ
- Run a container
- Generate systemd unit file
- Install unit file in /etc/systemd/system/
- Enable and start via systemctl
- Verify container survives system reboot (in test environment)
Exercise 5: Compose Migrationโ
- Create a docker-compose.yml with multiple services
- Convert to Podman Compose
- Start services with
podman-compose up - Verify all services communicate correctly
Summaryโ
Podman represents a modern approach to container management with these core strengths:
- Daemonless architecture โ Simpler, more secure design
- Rootless default โ Better security posture out-of-the-box
- First-class pods โ Native Kubernetes pod support
- Systemd integration โ Seamless Linux integration
- Docker compatibility โ Drop-in replacement for most workloads
- Open standards โ OCI-compliant, future-proof
For teams moving to Kubernetes or prioritizing security and simplicity, Podman is an excellent choice.