Install Docker Desktop on Windows Drive D: and Fix WSL Errors
Prerequisites:
- Enable Hyper-V.
- Enable Windows Subsystem for Linux.
- Download Docker Desktop for Windows.
- Knowledge of Windows Command Prompt.
3) Open windows command prompt as administrator and type below command to update WSL i.e.
wsl --update --web-download
4) Next, use below command to verify the version of WSL installed distro. By default, you will see version 1 next to your WSL distro. i.e.
wsl.exe -l -v
5) For Docker Desktop app to work without WSL unexpected errors. The supported WSL distro version is 2. So, use below commands to update your WSL distro version to 2. Note that change "Ubuntu" to the name of your installed distro .EXE file i.e.
wsl --set-default-version 2 wsl --set-version Ubuntu 2
6) Now, Download Docker Desktop Installer for windows to your target path and do not execute the file by double clicking. By default, Docker Desktop app will be installed into Drive C: which I do not recommend because it takes quite significant amount of disk storage space. So, if you install it on windows drive C: then your drive will quickly run out of space. I have placed my Docker Desktop Installer file on drive "D:\Dockers" folder.
7) Open windows command prompt as administrator again and change to your Docker Desktop Installer file path folder. Since, I have downloaded the file in "D:\Dockers" folder, so, below will be my commands to change into this directory i.e.
8) Now, type below command and hit enter. Make sure to change your target installation path, WSL default data path and windows container default path. The Docker Desktop app will be installed successfully on windows drive D: in my case. You can choose your target disk drive before executing below command. i.e.
start /w "" "Docker Desktop Installer.exe" install -accept-license --installation-dir="D:\Program Files\Docker\Docker" --wsl-default-data-root="D:\Program Files\Docker\wsl" --windows-containers-default-data-root="D:\\Program Files\\Docker\\win"
9) Open Docker Desktop app and you will be able to see that Docker Desktop app is running successfully without any unexpected WSL errors. Go to settings -> Resources -> WSL Integrations. You will be able to see your installed WSL distro in the available list. You can activate that distro if you like. Note that when your WSL version is 1, you not only see errors within Docker Desktop app but your WSL distro will also not display under WSL integrations because Docker Desktop app only supports WSL version 2. i.e.
Conclusion
In this article, you will learn to install Docker Desktop app error free. You will also learn to fix WSL unexpected error that occur because of improper installation of the Docker Desktop app on windows and finally, you will learn to install the Docker Desktop app on your target windows disk drive which is drive D: in this article.