Daniel's Tech Blog

Cloud Computing, Cloud Native & Kubernetes

Using Rancher Desktop as Docker Desktop replacement on macOS

Last year I wrote a blog post about running Podman on macOS with Multipass as a Docker Desktop replacement.

-> https://www.danielstechblog.io/running-podman-on-macos-with-multipass/

Back at that time I had looked also into Podman Machine and Rancher Desktop. Podman Machine was out very quickly without support for host volume mounts. Rancher Desktop instead was promising but the host volume mount performance was not that what I am used to, and you could not disable the Kubernetes component.

Since Rancher Desktop version 1.1.0, which has been released a couple of days ago, you can finally disable the Kubernetes component just using containerd or dockerd as your container runtime. Also, the host volume mount performance is now as good what Docker Desktop provides.

-> https://github.com/rancher-sandbox/rancher-desktop/releases/tag/v1.1.0

Kubernetes can be disabled to run just containerd or dockerd by itself for reduced resource consumption.

-> https://rancherdesktop.io/

So, here we are again talking about how to replace Docker Desktop on macOS with Rancher Desktop.

Rancher Desktop

When you have installed Rancher Desktop and start it for the first time you are greeted by the initial configuration screen.

Rancher Desktop Setup Screen

As I do not want to use the built-in Kubernetes component of Rancher Desktop, I uncheck it and switching the container runtime from containerd to dockerd.

The reason I am disabling the built-in Kubernetes component is the following that I am using KinD (Kubernetes in Docker) as my local Kubernetes setup providing a near identical setup locally what I am using in Azure with AKS. KinD offers a lot of customization like using another CNI component like Calico for CNI and network policies instead of relying on the built-in one. But this is a matter of taste, and you might be happy with the built-in Kubernetes component k3s of Rancher Desktop.

Rancher Desktop resource configuration

Rancher Desktop uses per default 2 CPUs and 4 GB memory which I adjusted to 4 CPUs and 8 GB memory. Those changes are applied by hitting the button Reset Kubernetes which in the end restarts Rancher Desktop.

Before we start with a quick check of Rancher Desktop let me tell you something about the default host volume mounts Rancher Desktop provides. Per default your home folder and the folder /tmp/rancher-desktop are available for mounting them into your containers.

Now let us do the quick check. I am spinning up the ACI hello world container image from Microsoft and map the port to port 80.

> docker run -d -p 80:80 mcr.microsoft.com/azuredocs/aci-helloworld:latest

> docker ps
CONTAINER ID   IMAGE                                               COMMAND                  CREATED          STATUS          PORTS                               NAMES
c6cad07051b9   mcr.microsoft.com/azuredocs/aci-helloworld:latest   "/bin/sh -c 'node /u…"   16 seconds ago   Up 14 seconds   0.0.0.0:80->80/tcp, :::80->80/tcp   clever_goldberg

Rancher Desktop ACI hello world

Like Docker Desktop the ACI hello world container can be reached via localhost.

If you want to use KinD as well on Rancher Desktop for Kubernetes, make sure you use the latest release v0.12.0.

-> https://github.com/kubernetes-sigs/kind/releases/tag/v0.12.0

I had not any success to spin up KinD with the version before on Rancher Desktop.

> docker ps
CONTAINER ID   IMAGE                  COMMAND                  CREATED        STATUS          PORTS                                                                                                     NAMES
f9dab90645b0   kindest/node:v1.23.4   "/usr/local/bin/entr…"   47 hours ago   Up 53 seconds   127.0.0.1:6443->6443/tcp, 127.0.0.1:80->30000/tcp, 127.0.0.1:443->30001/tcp, 127.0.0.1:15021->30002/tcp   kind-control-plane

> kubectl get nodes -o wide
NAME                 STATUS   ROLES                  AGE   VERSION   INTERNAL-IP   EXTERNAL-IP   OS-IMAGE       KERNEL-VERSION   CONTAINER-RUNTIME
kind-control-plane   Ready    control-plane,master   47h   v1.23.4   172.18.0.2    <none>        Ubuntu 21.10   5.10.93-0-virt   containerd://1.5.10

> kubectl get pods -n kube-system
NAME                                         READY   STATUS    RESTARTS      AGE
azure-policy-86bcfd97bf-n82kr                1/1     Running   4 (75s ago)   46h
azure-policy-webhook-559c5b7cb9-tlv96        1/1     Running   4 (75s ago)   46h
coredns-64897985d-b6z7p                      1/1     Running   2 (75s ago)   47h
coredns-64897985d-jkblr                      1/1     Running   2 (75s ago)   47h
etcd-kind-control-plane                      1/1     Running   2 (75s ago)   47h
kube-apiserver-kind-control-plane            1/1     Running   2 (75s ago)   47h
kube-controller-manager-kind-control-plane   1/1     Running   5 (75s ago)   47h
kube-proxy-r8f9f                             1/1     Running   2 (75s ago)   47h
kube-scheduler-kind-control-plane            1/1     Running   5 (75s ago)   47h
metrics-server-865ff485bf-gkxwl              1/1     Running   5 (75s ago)   47h

Summary

When you are looking for a real drop-in replacement of Docker Desktop on macOS, Rancher Desktop got you covered. As Rancher Desktop provides dockerd as runtime beside containerd all commands like docker and docker-compose continue to work out of the box. Also, Visual Studio Code immediately recognizes Rancher Desktop when you use dockerd as container runtime.

VS Code Docker Extension

WordPress Cookie Notice by Real Cookie Banner