Replacing Docker Desktop for macOS or Windows

Mohamed Sayed
4 min readJan 30, 2022

--

Photo by Ian Taylor on Unsplash

First when I heard about the license change for Docker Desktop I got mad a bit, but then I remembered the issue recently happened in the open source community when a developer for a package on NPM removed it completely; protesting corporate use without compensation.

I believe if we want our beloved tools to last, big companies should support them in one way or another.

With that said, as the open source community is still fun. Docker CLI and Docker Engine, still free to use to date according to Docker FAQs

So here are two relatively easy ways to run Docker without guilt.

1. Multipass

https://multipass.run uses hypervisor layer to launch on demand vm.

For insulation, easy wizard can be downloaded from here.

To start you can easily run the following command which will download a pre-built Ubuntu vm loaded with docker.

$ multipass launch -c 4 -m 4G -d 40G docker
Retrieving image: 100%
Launched: docker

To list all vm, you will get the following.

$ multipass list
Name State IPv4 Image
docker Running 192.168.64.3 Ubuntu 21.10
172.17.0.1

Take a note of 192.168.64.3 which is your vm IP address, accessible from the host machine

$ ping -c 3 192.168.64.3
PING 192.168.64.3 (192.168.64.3): 56 data bytes
64 bytes from 192.168.64.3: icmp_seq=0 ttl=64 time=2.263 ms
64 bytes from 192.168.64.3: icmp_seq=1 ttl=64 time=0.244 ms
64 bytes from 192.168.64.3: icmp_seq=2 ttl=64 time=0.245 ms

One more step before everything being fully function, the use files needed to be mounted inside the vm.

$ multipass mount $HOME docker

For example, docker for desktop mount the full user directory /Users/<username> for macOs for WSL2/Linux /home/<username> make it easier for you to mount directory inside the container.

Run $ multipass info docker to get vm info.

From there it is simple, you can access the vm shell and run docker command from there.

$ multipass shell docker
Last login: Sun Jan 30 00:06:38 2022 from 192.168.64.1
ubuntu@docker:~$

docker vm for multipass runs portainer a GUI for container management.

Go to http://<your vm ip>:9000 it will ask you to set the admin password and connect local docker, you will be able to see all the running container.

To overcome the idea of accessing the shell and to make it stick between reboots, you can add this alias to the end of your ZSH profile ~/.zprofile. If you are using a macOS version older than Catalina, then you will need to add it to the ~/.bash_profile. For Linux or WSL2, use ~/.bashrc; so you don’t have to train any new muscle memory.

alias docker='f(){ multipass exec docker -- docker "$@"}; f'

To run container

$ docker run -dt -p 8080:80 httpd

Go to http://<your vm IP>:8080

For docker-compose you will need to install it manually, enter vm shell $ multipass shell docker and run the following commands to install docker-compose.

$ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
$ sudo chmod +x /usr/local/bin/docker-compose
$ sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
$ docker-compose --version
docker-compose version 1.29.2, build 5becea4c

We can also create an alias for that poor memory of ours.

alias docker-compose='f(){ multipass exec docker -- docker-compose "$@"}; f'

Now, you have docker without Docker Desktop

2. Podman

https://podman.io is a daemonless container engine for developing, managing, and running OCI Containers on your Linux System. Containers can either be run as root or in rootless mode.

Mounting volume on macOS, not supported yet according to this GitHub issue.

For Apple Silicon some error might appear despite Podman supporting M1.

For installation is somehow straight forward

macOS, you need to run

If you don’t already have Brew, it can be installed in seconds using a one-liner. Please refer to Brew’s home page for more info “Brew’s home page”

$ brew install podman

Windows follow the instruction here but if already have WSL2. For more info on installation, check here.

To start the vm run, the following commands.

$ podman machine init  # downloads and counfigur the vm image
$ podman machine start # bootup the vm

from there you have a docker alike CLI it has the same commands

To list running containers

$ podman ps

To run container

$ podman run -dt -p 8080:80/tcp httpd

Go to http://127.0.0.1:8080 the port mapping between your host OS and the vm is done through gvproxy automatically.

For more information on How Podman runs on Macs and other container FAQs it is a very helpful guide if you want to understand the anatomy of Podman

Read more about the anatomy of Podman here.

To work with docker-compose, there is podman-compose which again has a similar interface for docker-compose, to follow the installation command here

To overcome the years of running docker & docker-compose commands, you can create an alias for podmanor podman-compose

alias docker="podman"
alias docker-compose="podman-compose"

If the Open Source community didn’t exist, the modern digital world in which we live today would have never existed. And the humans within this community still need to make a living.

I highly encourage you and your enterprises to support the projects you benefit from, either by subscribing to a suitable license or by a simple ☕️💳 contribution ❤️.

Please leave me your thoughts in the comment. If you have a better way of running docker guilt free, please drop that too, I tried running it using LinuxKit but no luck.

--

--

No responses yet