If you're developing on macOS or windows and you find podman too slow, you can host it on a native linux box and interface with it remotely through your client machine. These instructions are for podman, but the same thing can be achieved for docker.
This guide will cover how to do this using ssh as a connection between your macOS client and the remote linux podman host.
Setup Linux Host #
Install podman (on debian machine)
sudo apt install podman
Enable the podman daemon to listen to remote requests. Sudo should not be needed for this since it's enabled for the user.
systemctl --user --now enable podman.socket
Keep the socket alive so that the podman service works when logged out.
sudo loginctl enable-linger $USER
Setup macOS Client #
- Install podman
brew install podman
- If you do not have an ssh key setup to access the linux host where podman was installed above, you will need that (See resource 1 at the bottom).
- Add the linux host as a podman client connection.
podman system connection add my-new-connection --identity ~/.ssh/id_ed25519 ssh://<server-user>@<server-ip>/run/user/1000/podman/podman.sock
The "my-new-connection" can be any name you want. 4) Check the connection
podman system connection list
podman --remote info
If that's your only connection, that's it! Podman cli commands will now communicate with the linux host to execute container commands.
This connection can be set as the default if there are multiple connections: podman system connection default my-new-connection
Getting docker-compose working with podman remote #
- Install docker-compose on the macOS client
brew install docker-compse
- Ensure the DOCKER_HOST env variable is pointing at the remote server ssh connection
export DOCKER_HOST=ssh://<server-user>@<server-ip>
You may note that the exact socket reference can't be appended to the DOCKER_HOST url, so we need to make a couple changes on the remote host for docker-compose to work. The docker.sock path and docker command are both used by default when docker-compose executes. We can get around that by making a couple symlinks. - Now, on the linux host run
sudo ln -s /run/user/1000/podman/podman.sock /var/run/docker.sock
to symlink the podman.sock to where the docker.sock would be. - Then run
sudo ln -s /usr/bin/podman /usr/bin/docker
to create a symlink so that the docker command executes the podman binary.
At this point, docker-compose commands should function as expected using the remote podman host.
Resources #
Here are some resources ordered by most helpful.
- https://www.cloudassembler.com/post/remote-podman-service/
- https://github.com/containers/podman/issues/11397#issuecomment-910630550
- https://docs.oracle.com/en/learn/oracle-linux-platform-images/#create-a-system-connection-to-the-podman-server
- https://www.redhat.com/sysadmin/podman-clients-macos-windows