Hello Rancher Desktop!!

Wathsara Wishwantha Daluwatta
4 min readJan 30, 2022

Docker Desktop is an application which is available for Mac and Windows environments to build and share containerized applications. I have been using it for sometime mostly to use docker on my Mac.

I never had any reason to look for an alternative for docker desktop until I saw that Docker Desktop is no longer free for enterprise users.

I have figured out minikube and Rancher desktop as the two best alternatives for the Docker desktop. I have tried minikube which I felt was a really good docker desktop alternative. Minikube has been in the system for quite some time now, the community is quite good and the product is more stable. Even though that, I wanted to try the Rancher Desktop as Its something that I haven’t heard of previously.

This post is focused on Mac only.

Rancher Desktop

Rancher Desktop (RD) is an open-source application to run Kubernetes and container management. It provides capability to manage containers either by using containerd or dockerd(Moby) as the container runtime. It is available for Mac (both on Intel and Apple Silicon), Windows, and Linux. Visit https://rancherdesktop.io find out more details.

Although my experience with Rancher Desktop is very little, I think it’s a really good alternative for docker desktop. But there were few issues I have faced while I’m working with docker on the Rancher Desktop.

1. Run a docker container on ports 80 and 443.

The first thing I did after installing the RD was to run the docker ps command. It has listed several running containers but It was not a problem for me at that point.

docker ps output

Then after I ran a nginx container to verify whether everything is working fine. (docker run — name nginx -p 80:80 nginx). Then I opened my browser and tried to reach the 127.0.0.1 and It says 404 not found but I was expecting the Welcome to nginx!. After doing an initial research I have found that It’s causing due a ingress controller which is included in the K3s. Since I want to run the container only, I was able to fix this by disabling the Kubernetes manually by deleting the node.

kubectl config use-context rancher-desktop && kubectl delete node lima-rancher-desktop

2. host.docker.internal

host.docker,internal which is a special DNS name to resolve to the internal IP address used by the host. This has been used to communicate with the services running in the host machine.

By default this host mapping has been added by the RD to the VM (https://github.com/rancher-sandbox/rancher-desktop/pull/1000). So whenever you are running a container on a host network you will get the host.docker.internal inside your container. If you want to verify run a nginx container in the host network using docker run — name nginx-2 — network host -it nginx bash and then execute cat /etc/hosts to see the host mapping available for the container.

Output of cat /etc/hosts

You will see 192.168.5.2 has been mapped to host.docker.internal. Now you can do the same thing if you want the host.docker,internal inside your container and not wanting to run it on the host network by using docker run — name nginx-2 — add-host host.docker.internal:192.168.5.2 nginx

192.168.5.2 — There is no official place where it is mentioned that this IP is static or not. As I think, this has to be the Lima/QEMU gateway IP so it has to be static with RD.

3. Is the docker daemon running?

I had an issue getting Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? after executing an automated script I have written to set up few applications. After this issue I have to Quit and Launch the RD to work with docker commands again.

I have faced a similar kind of issue with docker desktop where it gets crashed if we kill processes running on a port where a container is running. Which actually helped me a lot to identify what the issue is.

In RD, if we kill processes running using kill -9 $(lsof -ti:<port>) or npx kill-port <port> using any other way, it will end up with Cannot connect to the Docker daemon. So make sure to be aware of that.

Conclusion

Although the rancher desktop is young, it has become one of the most favorite alternatives for the docker desktop. Even though I have been using it for a few days, I’m so impressed with how it works. Biggest drawback I’m seeing at the moment is the community support. Finally I would love to mention to you that RD is a superb alternative to docker desktop.

Thank you for reading my article. Have a Good Day!!

References

--

--

Wathsara Wishwantha Daluwatta

Software Engineer at WSO2 | Studied BSc (Hons) Software Engineering at University of Colombo School of Computing