Replacing Docker Desktop with WSL2 and/or Rancher Desktop on Windows

When I have wanted to build a container image and/or run a little local Kubernetes on my laptop I traditionally have used Docker Desktop for both. With their recent announcement I went looking for possible alternatives.

This initial post focuses on Windows — I will do a follow-up one with a view to the Mac.

Docker Engine on Linux via WSL2

Note in the above announcement that it says “that licensing for Docker Engine and the upstream Docker and Moby open source projects is not changing.” Docker Engine for Linux is fully open sourced (under the Apache license) and we can continue to use that for free. What Docker Desktop gave us in addition to that on Windows was running a Linux VM they set up for us wrapped around it (these days also running via WSL2), installation of the local CLI for docker and kubectl to map through to that VM, as well as installing a containerised Kubernetes in that VM for us optionally as well.

Given my main laptop for container work at the moment is a Windows 10 machine where I heavily use Ubuntu via WSL2, I was curious if I could just install Docker in Ubuntu there and have it work within that Linux environment. The good news is yes you can!

First, install Ubuntu WSL2 if you have not already. MS documents that here. Then you can just follow the instructions here with one exception — The exception is that there is no systemd in WSL2 so you just have to run sudo dockerd to start dockerd directly. You might want to run it with an & at the end in to run it in the background if you don’t want to dedicate a tab in your Terminal to it in the foreground that you’ll need to close or ctrl-c out of when you’re done.

This works quite well in a couple respects:

  • It automatically maps the ports through so that you can do a docker run -p 8080:8080 and then go to http://localhost:8080 in your browser on the Windows side
  • Not only can you run your docker commands and scripts within WSL2 instead of via the Command Prompt or PowerShell but many IDEs like Visual Studio Code can sync your code to the WSL side and run things there natively. This is detailed for VS Code here —

So, if all you wanted Docker Desktop for is doing docker build and docker run of Linux containers then you can just uninstall Docker Desktop and do the above instead — sticking to the opensource docker engine and saving you from having to pay Docker for Desktop.

For Windows Containers, though, it doesn’t appear possible to install just the Docker Engine outside of Docker Desktop on Windows 10 —

Rancher Desktop for Kubernetes

That sorts us out for straight docker commands for our Linux containers, but what about the local Kubernetes it provided? There are various ways you could do that also in Ubuntu under WSL (kind etc.) but I also recently stumbled on Rancher Desktop which is free and open source and seems to be a great new tool for this use-case. I decided to give it a try.

This tool:

  • Installs a new Linux VM in WSL2 that has a Kubernetes cluster based on k3s as well as installs various components in it such as KIM (for building docker images on the cluster) and the Traefik Ingress Controller
  • It installs the kubectl and Helm CLIs on the Windows side linked to them
  • A nice Windows app to manage its settings and help facilitate its upgrades

If you do a kubectl get all -A -o name this is what it ships with out-of-the-box (using only 1.2GB of RAM total):


Not bad considering it has metrics-server so kubectl top works as well as an Ingress controller etc.

I tried a go-to simple example I use for Kubernetes (swapping out my usual Ingress class annotation for the traefik I see running):

apiVersion: apps/v1
kind: Deployment
name: hello-kubernetes
replicas: 2
app: hello-kubernetes
app: hello-kubernetes
- name: hello-kubernetes
image: paulbouwer/hello-kubernetes:1.10
- containerPort: 8080
memory: "512Mi"
cpu: "0.5"
memory: "512Mi"
cpu: "0.5"
scheme: HTTP
path: /
port: 8080
scheme: HTTP
path: /
port: 8080
apiVersion: v1
kind: Service
name: hello-kubernetes
type: ClusterIP
- port: 80
targetPort: 8080
app: hello-kubernetes
kind: Ingress
name: hello-kubernetes
annotations: traefik
- http:
- path: "/"
pathType: Prefix
name: hello-kubernetes
number: 80

I could see the pod running so I figured I wanted to see I could get to it via the Ingress controller. I did a kubectl get ingress and got this back:

NAME               CLASS    HOSTS   ADDRESS         PORTS   AGE
hello-kubernetes <none> * 80 79s

And sure enough I went to on my browser on the Windows side and it worked!

I also noticed another thing in the Rancher Desktop app — a port forwarding tab:

This is listing all the Services on the cluster. I clicked the Forward button next to hello-kubernetes and port 55350 appeared. I then went to http://localhost:55350 and it also worked!

So, now that we know that our local Kubernetes experience is good, let’s check out another thing we used to get out of Docker Desktop — I could build a container image locally with a docker build and then immediately use it within the cluster. The way that you do that here is with kim. This mimics the docker build command but it hands the build off to a service running on our local Kubernetes cluster to do the builds and pushes.

I got the Dockerfile for hello-kubernetes and built it with a kim build instead of the usual docker build. I then tried to update the definition above to use that local image instead (it hadn’t been pushed anywhere) and got an image pull error. It turns out that you need to change imagePullPolicy in the Pod Spec to Never or IfNotPresent in order to use these local images on the Kubernetes VM that kim builds — which makes sense. But otherwise that works great as well!


With the seeming exception of Windows containers, I feel that the combination of docker engine via WSL2 for when you need docker and Rancher Desktop for when you need a local Kubernetes experience is a great free alternative to Docker Desktop on Windows.

Give it a try today!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store