Skip to content

Using podman instead of docker for your gitlab-runner as docker executor

So I'm replacing docker with podman everywhere. Podman is an easy drop in replacement for docker. Install it and replace docker with podman in your container commands:


podman run -it --rm nginx:latest
docker run -it --rm nginx:latest

Since the release of podman API 2.0 there is even a drop in replacement for the docker socket/API.

And this addition is crucial for my gitlab-runners that are using the docker executor.

How gitlab-runner can make use of it

As of now (2020-04-16) aka gitlab runner version 13.10 there is no native podman support. It is planed but not out there yet.

But how can the docker executor use podman now? Simply by forcing it to use podman's API socket.

This was done on Ubuntu 20.04. But Gitlab and Podman documentation has covered many other distributions.

Enable and start podman socket after installation

$ systemctl enable --now podman

Register gitlab-runner

By pointing DOCKER_HOST environment variable to the podman socket and passing it through as volume, the docker executor becomes basically a podman executor.

$ gitlab-runner register \
    --non-interactive \
    --url "<GITLAB_SERVER_URL>" \
    --registration-token "<GITLAB_REGISTRATION_TOKEN>" \
    --executor docker \
    --docker-privileged=true \
    --env "DOCKER_HOST=unix:///var/run/podman/podman.sock" \
    --docker-image alpine:latest \
    --docker-volumes "/run/podman/podman.sock:/var/run/podman/podman.sock" \
    --tag-list "podman,docker,privileged"

That's it =).


Enabling podman.sock, passing it through and announcing it via DOCKER_HOST is a surprisingly easy workaround until gitlab-runner gets native podman support. So far I've encountered no issues. It look and fells like the usual docker executer but podman is doing the heavy lifting in the background.

Last update: April 24, 2021