Replacing Docker Desktop with Podman and Kind in MacOS
For years, I have been working with Docker Desktop to build and test images and spin up a local kubernetes cluster when needed. However, in August, 2021 Docker announced that by the beginning of 1st February, 2022 they would begin to place limitations on the free use of its Docker Desktop software. Due to this, lot of engineers were forced to uninstall Docker Desktop from their machines.
In this article I thought I’d share how I set up an alternative to Docker Desktop functionality in my macbook
Podman Engine to replace Docker Engine
Podman 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.
brew install podman-desktop
Since we are running this on Mac, Podman automatically spins up a virtual machine with a linux kernel so we can run containers within it. To get started run the following commands.
podman machine init
podman machine start
After successfully starting the machine, you can spin up a container and test it’s functionality.
podman run --name nginx -p 8080:80 nginx
By going to http://localhost:8080 you should see the container running and port binding working.
Podman CLI is similar to the docker CLI. Therefore the last thing to do is set an alias docker so it will execute podman as follows. You can add the following line to your ~/.bashrc or ~/.zshrc and start typing docker commands away as you were used to.
Kind clusters to replace minikube
kind is a tool for running local Kubernetes clusters using Docker container “nodes”. kind was primarily designed for testing Kubernetes itself, but may be used for local development or CI.
brew install kind
To get kind working with Podman we need to export the following environment variable. It’s better to add this to your ~/.bashrc or ~/.zshrc file.
Once done, just run the following
kind create cluster
Now your cluster is ready to go with kubeconfig automatically pointed towards the kind cluster.
Additional: Easy Kube Context Switch
One of the things I loved about docker desktop was the ability to switch kube context very easily from the menubar of my macOS. This can be easily done by installing the plugin https://github.com/turkenh/KubeContext which would look like following.
Well, you can easily cleanup by shutting down the podman machine by running the following command.
podman machine stop
I hope this was helpful. This setup is also valid for Windows and Linux systems; there are just different installation manuals for each. Another option is Rancher Desktop, but I ran into some problems with it on my Mac.