DEV Community

Alex Spinov
Alex Spinov

Posted on

Podman Has a Free API — Rootless Containers Without Docker Daemon

Podman is a daemonless container engine that runs containers as your regular user — no root, no daemon, no Docker socket. It's CLI-compatible with Docker but architecturally superior.

Why Podman Over Docker?

  • No daemon — each container is a child process, not managed by a central service
  • Rootless by default — containers run as your user, not as root
  • Pods — group containers like Kubernetes pods, locally
  • Docker-compatiblealias docker=podman works for 95% of commands

Quick Start

# Install (Fedora/RHEL)
sudo dnf install podman

# Install (Ubuntu)
sudo apt install podman

# Install (macOS)
brew install podman
podman machine init
podman machine start
Enter fullscreen mode Exit fullscreen mode

Basic Commands (Same as Docker)

# Run a container
podman run -d --name web -p 8080:80 nginx

# List running containers
podman ps

# Exec into container
podman exec -it web bash

# Build from Dockerfile
podman build -t myapp .

# Push to registry
podman push myapp docker.io/myuser/myapp
Enter fullscreen mode Exit fullscreen mode

Pods — Kubernetes-Style Grouping

# 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 frontend nginx
podman run -d --pod webapp --name db postgres:16

# Containers in the same pod share localhost
# frontend can reach postgres at localhost:5432

# Generate Kubernetes YAML from pod
podman generate kube webapp > webapp.yaml
Enter fullscreen mode Exit fullscreen mode

Podman Compose

# Install
pip install podman-compose

# Use your existing docker-compose.yml
podman-compose up -d
podman-compose logs -f
podman-compose down
Enter fullscreen mode Exit fullscreen mode

Rootless Containers

# No sudo needed!
podman run --rm alpine whoami
# Output: root (but it's mapped to your UID on the host!)

# Check user namespace mapping
podman unshare cat /proc/self/uid_map
Enter fullscreen mode Exit fullscreen mode

Systemd Integration

# Generate systemd service from container
podman generate systemd --new --name web > ~/.config/systemd/user/web.service

# Enable and start
systemctl --user enable --now web.service

# Container auto-starts on login, auto-restarts on crash
Enter fullscreen mode Exit fullscreen mode

Podman REST API

# Start API socket
podman system service --time=0 &

# List containers via API
curl --unix-socket /run/user/$(id -u)/podman/podman.sock \
  http://localhost/v4.0.0/libpod/containers/json

# Create container via API
curl --unix-socket /run/user/$(id -u)/podman/podman.sock \
  -X POST http://localhost/v4.0.0/libpod/containers/create \
  -H 'Content-Type: application/json' \
  -d '{"image": "nginx", "name": "webapi"}'
Enter fullscreen mode Exit fullscreen mode

Need to containerize your scraping infrastructure? Check out my Apify actors for production-ready scrapers, or email spinov001@gmail.com for custom container-based solutions.

Docker or Podman — which do you use in production? Share below!

Top comments (0)