This will explain how to get docker-compose in an Ubuntu 22 distrobox working with podman on a Fedora Silverblue host. This assumes you have the Ubuntu distrobox up and running, and you've installed docker-compose from either the apt repository or downloading the binary and placing it in your distrobox users path.
First, on the Silverblue host you need to ensure the podman socket is enabled and running.
systemctl --user enable podman.socket
systemctl --user start podman.socket
systemctl --user status podman.socket
Next, inside your Ubuntu distrobox, ensure this variable is exported in your shell environment.
The value '1000' should be whatever value running echo "$UID"
on the Silverblue host gives you
1export DOCKER_HOST=unix:////run/host/run/user/1000/podman/podman.sock
Now, things may mostly just work, but we want to ensure all "docker" commands that run inside the distrobox are aliased to the podman binary on the Silverblue host. There are a couple things to account for with this.
- The distrobox container and host likely share the same home directory. Any alias or path symlink needs to be isolated to only affect commands run in the distrobox container.
- The host podman binary can't be executed directly from inside the distrobox container, e.g. trying to run
/run/host/usr/bin/podman
won't work.
To work around this, we'll create a small executable script with the name docker
and place it in a directory that it's in the path of the distrobox user, but not in the path of the Silverblue host user.
All this script does is pass any arguments invoked with the command docker
to the host podman command.
1#!/usr/bin/env bash
2
3distrobox-host-exec podman "$@"
With all this in place, running docker-compose commands inside the distrobox container should function and use the Silverblue host podman as the container engine.