Running Podman from a Toolbox container
Topics: Podman
Managing Podman (or Docker) containers from a Container toolbox is pretty simple, thanks to the clever way toolbox containers get set up with all necessary resources. We just have to point our tools in the right direction.
On the host, enable the Podman socket:
systemctl --user enable podman.socket --now
Inside the toolbox container, make sure the socket gets used. I put this in my .zshenv.local:
export DOCKER_HOST=unix:///run/user/1000/podman/podman.sock
Then, set up Podman in the toolbox. At this opportunity, we’ll also install docker-compose. The docker command will remain a simple alias.
sudo dnf install -y podman-remote docker-compose
sudo ln -s /usr/bin/podman-remote /usr/bin/podman
sudo ln -s /usr/bin/podman-remote /usr/bin/docker
And with that, a docker ps should work now!
Issues with SELinux
If SELinux causes “permission denied” errors, we disable labeling in ~/.config/containers/containers.conf:
[containers]
label = false