Skip to content

devonfw-forge/rd-installer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rancher Desktop as Docker Desktop alternative

You are a few steps far from moving away from Docker Desktop to a much more powerful free alternative, which will enable you to introduce Kubernetes in your development environment if desired, or continue working as normal with plain Docker-like containers.

If you are new to containers or you are not already familiar with Docker, we encourage you to take some courses (like this one) or research on the web about Docker, which has been the most spread solution so far for containerization.

Installation

The script install.ps1 will install the Rancher Desktop solution along with some extra features:

  • Support for usual Docker commands in Powershell and Bash (flag -Alias).

  • Support for enterprise VPNs (flag -VPN).

  • Support (additional) for Windows Containers using Docker binary (flag -WindowsContainers). You do not need to choose anymore!

To install it, clone the repository and run install.ps1 with the desired flags.

Tipically, you just need to either:

.\install.ps1 -Alias -VPN -WindowsContainers

or right-click on the install script and select "Run with PowerShell", it will default to the above flags.

Important
You may be asked to reboot your computer. This happens when you do not have the required Windows features already enabled. If so, relaunch installation process after restart.
Caution
Do not enable auto-update in Rancher Desktop settings. VPN support is known to break after v1.1.1.

Usage

Using Linux containers is very simple, just make sure Rancher Desktop is started, that you do not change default containerd runtime, and go ahead running the Docker commands you are used to:

  • docker <command>

  • docker-compose <command>

For using Windows containers, start the daemon with dockerw-start, and perform a minor change in the commands (note the w):

  • dockerw <command>

  • dockerw-compose <command>

Tips and tricks

Volume binding on docker-compose

Host paths should be written in Unix-style (using /).

In particular, Windows absolute paths should be converted as follows:

volumes:
  # Docker Desktop:
  # - C:\Users\Joey\Desktop\backend:/var/www/html
  # Rancher Desktop:
  - /c/Users/Joey/Desktop/backend:/var/www/html

Fix Docker not working when called from other applications (i.e. not using a shell). Universal docker command support.

Often seen as error: image operating system "linux" cannot be used on this platform.

In some cases, Docker commands are executed by third-party applications that rely on binary paths. Also, there are complex scenarios where the alias set on the shell profiles do not apply and existing docker commands fail. To solve that, you can use -RenameBinaries flag (instead of -Alias) on installation, which provides universal docker command support by renaming binaries names.

Please note this has the side effect of requiring you to change existing docker-compose commands to docker compose.

Behind the scenes

Rancher Desktop with containerd offers nerdctl as CLI. Although command syntax is the same, this requires a lot of changes on existing scripts and it takes time to get used to new command naming. Also, to run Docker Windows containers you need to specify the context, which is annoying. To solve these issues, when executing the installer with -Alias flag, the following alias are set on default PowerShell and Bash profiles:

  • docker and docker-compose to nerdctl and nerdctl compose for Linux containers.

  • dockerw and dockerw-compose to docker --context win and docker compose --context win for Windows containers.

Tip
Some Windows containers lazy power users may want to keep using docker as the default command for them. In such case, do not use -Alias installation flag and make win context the default one.

Extra features

Rancher Desktop comes with the option to enable a local Kubernetes cluster you can work with.

This feature comes disabled by default, but you can activate it on Rancher Desktop app > Kubernetes Settings by checking Enable Kubernetes box.

Uninstall

To uninstall Rancher Desktop and all the extra features execute the script uninstall.ps1.

The uninstall script will cleanup the environment variables, folders and tools, leaving your computer as clean as it was.