Linux Podman for WordPress: Rootless Containers Without Docker

Podman for WordPress: rootless containers and Compose files without the Docker daemon

Docker runs a daemon as root, and anyone who can talk to it effectively has root on the machine. Podman runs containers without a central daemon and, by default, without root: the containers run as processes of the user who started them. It understands Docker images and, through podman compose or its Docker-compatible API, most Compose files, which makes it a drop-in alternative for local WordPress development and small production hosts.

Problem: A company’s security policy forbids the Docker daemon on developer laptops and on its Linux servers. The team’s WordPress setup is a compose.yaml with Nginx, PHP-FPM and MariaDB.

Solution: Install Podman, run the existing Compose file with podman compose, fix the two typical differences (fully qualified image names, file ownership in bind mounts with :U or userns_mode: keep-id), and on servers run the stack as a systemd service of an unprivileged user with Quadlet files.

Run the existing Compose file

sudo apt install podman podman-compose      # or: brew install podman && podman machine init && podman machine start
podman compose up -d
podman ps
podman logs -f wordpress

On macOS and Windows, Podman runs a small Linux VM (podman machine), similar to Docker Desktop. podman compose calls a Compose provider (podman-compose or docker-compose) against Podman’s API.

Image names

services:
  db:
    image: docker.io/library/mariadb:11.4
  wordpress:
    image: docker.io/library/wordpress:php8.3-fpm

Docker assumes Docker Hub for short names like mariadb. Podman asks which registry to use, or fails in non-interactive use; fully qualified names avoid that and make the source explicit.

File ownership in rootless mode

In rootless mode, the container’s root user is mapped to your own user, and the container’s www-data (UID 33) is mapped to a sub-UID that does not exist on the host. Files that WordPress creates in a bind mount then belong to an odd numeric owner, and you cannot edit them.

services:
  wordpress:
    volumes:
      - ./wp-content/themes/ha-theme:/var/www/html/wp-content/themes/ha-theme:U

:U changes the ownership of the mounted folder to match the container user. The alternative is userns_mode: keep-id (or --userns=keep-id), which maps your host user to the same UID inside the container; combined with running PHP-FPM as that UID, files keep your ownership on both sides. The Compose setup itself: Docker Compose for local WordPress.

On a server: Quadlet and systemd

# ~/.config/containers/systemd/wp-db.container
[Container]
Image=docker.io/library/mariadb:11.4
Volume=wp-db.volume:/var/lib/mysql
EnvironmentFile=%h/wp/.env
Network=wp.network

[Install]
WantedBy=default.target
systemctl --user daemon-reload
systemctl --user start wp-db
loginctl enable-linger deploy      # keep user services running without a login session

Quadlet files (Podman 4.4+) describe containers, volumes and networks as systemd units: they start at boot, restart on failure and log to the journal, without a daemon and without root. Ports below 1024 need either a reverse proxy on the host or net.ipv4.ip_unprivileged_port_start lowered.

NOTE: Most Docker commands work with Podman by replacing docker with podman; tools that need the Docker socket (wp-env, some IDE integrations) can use Podman’s compatible socket (systemctl --user enable --now podman.socket and DOCKER_HOST pointing to it), with varying success. Resource limits per site on the same host: systemd slices and cgroups v2.