Ryan Martin

Trick Docker Compose to Use Podman

I recently discovered a way to use Podman as the backend for Docker Compose. Docker Compose checks the DOCKER_HOST environment variable to determine which daemon socket to connect to. Podman doesn’t run a daemon by default, so we need to enable it first:

# starts the podman socket as a non-root user
systemctl --user enable podman.socket
systemctl --user start podman.socket
systemctl --user status podman.socket

This will create the socket at /run/user/$UID/podman/podman.sock, which we’ll need to set as the value of DOCKER_HOST.

export DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock

And that’s it. Docker Compose should use Podman as the container engine now.

This works for tools that use Docker as a library, like the Supabase CLI, but it won’t work for tools that call your system’s docker binary directly. You can read more about using Podman with Docker Compose in this Fedora Magazine post.

Props to @GZGavinZhao for sharing the original solution to this issue.

Tags: