How to Install & Configure Rancher-Desktop on Windows (How to Run Docker & Kubernetes on Windows)
Table of Contents
Introduction
This tutorial will guide you through the installation and configuration of Rancher Desktop on Windows. By the end of this guide, you will be able to run Docker containers and manage them using Kubernetes, making it a suitable alternative to Docker Desktop. This setup leverages Windows Subsystem for Linux (WSL2) to provide a seamless Linux development environment on your Windows machine.
Step 1: Enable Windows Subsystem for Linux
To run Rancher Desktop effectively, you need to enable the Windows Subsystem for Linux. Follow these steps:
- Open Command Prompt as Administrator.
- Run the following command to enable WSL:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Step 2: Enable Virtual Machine Feature
Next, you need to enable the Virtual Machine feature, which is essential for WSL2.
- In the same Command Prompt window, execute:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Step 3: Set WSL2 as the Default Version
Setting WSL2 as your default version is crucial for compatibility with Rancher Desktop.
- Still in Command Prompt, run:
wsl --set-default-version 2
Step 4: Verify WSL Version
Check if WSL is correctly set up and verify the installed version.
- Run the following command:
wsl -l -v - Ensure that your Linux distribution is listed with version 2.
Step 5: Install Rancher Desktop
With WSL2 set up, you can now install Rancher Desktop.
- Download Rancher Desktop from the official website.
- Run the installer and follow the setup prompts.
Step 6: Configure Docker Permissions
To avoid permission issues when using Docker, you need to adjust some settings in WSL.
- Open your WSL terminal (e.g., Ubuntu).
- Run the following commands:
sudo addgroup --system docker sudo adduser $USER docker newgrp docker - Adjust the Docker socket permissions:
Alternatively, you can run:sudo chown root:docker /var/run/docker.sock sudo chmod g+w /var/run/docker.socksudo chmod 666 /var/run/docker.sock
Step 7: Launch Rancher Desktop
Now that everything is set up, you can launch Rancher Desktop.
- Open Rancher Desktop from your Start menu.
- Configure your Kubernetes settings as desired, including selecting the version of Kubernetes you want to use.
Step 8: Running Docker Containers
You can now run Docker containers using Rancher Desktop.
- To run a container, use the command:
docker run hello-world - Verify that your container runs successfully.
Conclusion
You have successfully installed and configured Rancher Desktop on Windows, enabling you to run Docker containers and manage them with Kubernetes. As you continue to explore containerized workflows, consider experimenting with different Kubernetes configurations and workload management options. Happy coding!