Never again Docker on macOS

If you don't want to use Docker Desktop because it's extremely annoying without a Pro account, since you always have to apply every update immediately, Docker on macOS can become a real pain in the ass. In theory, docker-machine should be an alternative. Unfortunately, it often causes problems with VirtualBox or the network configuration when using Hyperkit isn't working. Fortunately, I always have enough Linux machines available. However, it is of course also annoying when you always have to log in to another computer just to build a Docker image. But there is a simple solution for this if you have a Linux machine available.

First of all, of course, install Docker on the Linux machine. Make sure your user can use the Docker by adding it to the group docker. Then set up an SSH connection for which you don't need a password. For this create an SSH key with ssh-keygen. Add the public key to $HOME/.ssh/authorized_keys on the Linux host (create the file if it doesn't exist). On your Mac, add the private key to the SSH agent using ssh-add /path/to/private/keyfile. Test the connection by logging into your Linux machine using ssh username@ip-address.

If everything works, create a context for your Docker CLI:

docker context create myserver --docker "host=ssh://username@X.X.X.X:22"

And finally tell the Docker CLI to use this context:

docker context use myserver

Now you can use your docker command as usual and it will automatically use the Docker daemon on the Linux host.


You'll only receive email when they publish something new.

More from Bitmuncher
All posts