Rancher Desktop with both Windows and Linux Containers

With the recent licensing changes to Docker Desktop many developers are setting out to find potential alternatives. One of these, Rancher Desktop, caught my attention as a very direct replacement for what Docker Desktop offers. I have no problem with Docker wanting to charge for Desktop especially given the core engine and CLI remain free and open source.

The primary challenges I have included: out-of-the-box support for existing projects (e.g. docker build), support for both Linux and Windows container workloads, and dev tool support. Nice to haves include a super easy installation / management process, some UI for managing images, etc. and one-click install of features like Kubernetes.

SETUP (Rancher Desktop – Linux Containers on Windows)

To start, I already had a working Docker Desktop solution on Windows using WSL2. First step, uninstall Docker Desktop.

Next, I ran the Rancher Desktop (for Windows) installer and within minutes was already back up and running with a Linux containers solution. Rancher Desktop created its own WSL distros and hooked them up to the local docker CLI. I choose the Docker engine (e.g. Moby) with the hopes it would work with existing CLIs and dev tools

SUCCESS! I was able to take an existing project and just ‘docker build’ it and everything was perfect. Even the Docker extension for VS Code worked directly to see the images and container instances. If I only needed Linux container support I’d be done here.

WINDOWS CONTAINERS (side-by-side)

Docker does supply an open source dockerd for Windows to support Windows Containers (which I have already enabled in Windows 10). After downloading and extracting, if I were to just run dockerd I get a conflict because it is trying to use the same named pipe as the current Linux-based daemon. Simply enough, I was able to run (as admin) the following command to launch a side-by-side dockerd:

dockerd.exe -H npipe:////./pipe/docker_windows

After launching, all I needed to do was create a new docker CLI context so I could target that named pipe more easily:

docker context create win --docker host=npipe:////./pipe/docker_windows

Finally, I launch the typical hello-world example, targeting the “win” context:

docker -c win run hello-world

Final steps will be for me to install this as a service and have it always running.

Advertisement

3 thoughts on “Rancher Desktop with both Windows and Linux Containers

  1. When i run the first command, i get the following message below. Docker service is already running, also i can run a simple hello world image (servercore:1809). Can you please help what am i missing here? Thank you.

    PS C:\> dockerd.exe -H npipe:////./pipe/docker_windows
    time=”2022-04-22T23:32:09.240515200+02:00″ level=info msg=”Starting up”
    time=”2022-04-22T23:32:09.244513600+02:00″ level=info msg=”Windows default isolation mode: hyperv”
    2022-04-22 23:32:10.240575 I | bolt.Close(): funlock error: The segment is already unlocked.
    failed to start daemon: error while opening volume store metadata database: timeout

  2. Ok found out docker service is already running, had to stop it, now the command works.
    Thank you for this post! Your awesome!

Leave a Reply to jagostoni Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s