Configuring WSL2 for Seamless Compatibility with Rancher Desktop
Just out of curiosity, I downloaded and sat up Rancher Desktop on my laptop.
In this (very short) article, we’ll go over the necessary steps to configure WSL2 Ubuntu virtual machines and Docker with Rancher Desktop.
The setup is quite straightforward. Follow the instructions provided in the official documentation to get Rancher Desktop up and running on your Windows machine. Rancher Desktop allows you to run Docker and Docker Compose seamlessly within a WSL2 environment.
After installing Rancher Desktop, you will need to ensure your virtual machine (VM) is connected to expose the Docker daemon and related commands. You can find detailed steps in the Rancher Desktop documentation under WSL Preferences. Don’t forget that in some cases, you may need to restart both WSL2 and Rancher Desktop for the changes to take effect.
When you start your Docker compose infrastructure and encounter an error like this:
You’ll need to configure Docker’s credential store. To resolve this issue, follow these steps:
- Inside your WSL2 VM, create or edit the
- Add the following content to the
This configuration points to the
docker-credential-wincred.exe binary and will resolve the credential storage problem when using Docker.
A common issue with Docker containers in Rancher Desktop is the lack of output in the console when running a container, such as with the command
docker run hello-world.
This issue is well-documented in this GitHub issue.
To view the container’s output in the console, you need to start your commands with the
-i option. For example:
This option tells Docker to attach to the container’s standard input, allowing you to see the output directly in your console.
I hope this article has been helpful for you, and you’re now ready to supercharge your development workflow with Rancher Desktop and Docker!