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.
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. |
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>
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
.
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
anddocker-compose
tonerdctl
andnerdctl compose
for Linux containers. -
dockerw
anddockerw-compose
todocker --context win
anddocker 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.
|
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.