How to Set Up Podman as a Docker Alternative
Podman is a daemonless container engine that runs containers without requiring a root-level daemon process. It provides a Docker-compatible CLI, making it a drop-in replacement for most Docker workflows on your Breeze server.
Why Choose Podman
- Daemonless — no background daemon means fewer security risks and simpler management
- Rootless containers — run containers as a non-root user for better security
- Docker-compatible — same CLI commands and Dockerfile support
- Pod support — group related containers into pods, similar to Kubernetes pods
- Systemd integration — generate systemd service files directly from containers
Installing Podman
# Ubuntu 22.04+
sudo apt update && sudo apt install -y podman
# RHEL/AlmaLinux/Rocky 9
sudo dnf install -y podman
# Verify installation
podman --version
podman info
Running Containers with Podman
Podman uses the same syntax as Docker:
# Run an Nginx container
podman run -d --name web -p 8080:80 nginx:latest
# List running containers
podman ps
# View logs
podman logs web
# Execute a command inside the container
podman exec -it web bash
# Stop and remove
podman stop web && podman rm web
Rootless Containers
Run containers as a non-root user for enhanced security:
# Ensure user namespaces are configured
grep $(whoami) /etc/subuid
grep $(whoami) /etc/subgid
# If not present, add them
sudo usermod --add-subuids 100000-165535 --add-subgids 100000-165535 $(whoami)
podman system migrate
# Run rootless container
podman run -d --name myapp -p 8080:80 myapp:latest
Working with Pods
Pods group containers that share network and IPC namespaces:
# Create a pod
podman pod create --name webapp -p 8080:80 -p 5432:5432
# Add containers to the pod
podman run -d --pod webapp --name app nginx:latest
podman run -d --pod webapp --name db \
-e POSTGRES_PASSWORD=secret postgres:16
# List pods
podman pod ps
# Stop entire pod
podman pod stop webapp
Generating Systemd Services
Let Podman create systemd unit files for automatic container management:
# Generate a systemd service for a container
podman generate systemd --new --name myapp > ~/.config/systemd/user/myapp.service
# Enable and start
systemctl --user daemon-reload
systemctl --user enable --now myapp.service
# Check status
systemctl --user status myapp.service
Docker Compose Compatibility
Use podman-compose or Docker Compose with the Podman socket:
# Install podman-compose
pip install podman-compose
# Use existing docker-compose.yml files
podman-compose up -d
podman-compose ps
podman-compose down
# Or enable the Podman socket for Docker Compose
systemctl --user enable --now podman.socket
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock
docker compose up -d
Docker Alias for Seamless Migration
# Add to ~/.bashrc for Docker-like experience
alias docker=podman
Best Practices
- Use rootless mode for all application containers on your Breeze server
- Generate systemd services for containers that should start at boot
- Use pods when containers need to communicate over localhost
- Configure container registries in
/etc/containers/registries.conf - Regularly run
podman system pruneto clean up unused images and containers