Docker not starting on Windows 11 with WSL 2
Asked Answered
A

15

31

I'm trying to setup docker with WSL 2 to run a Dockerfile. I downloaded Docker Desktop, and when I tried to follow the quick start guide, I got the following error:

docker: error during connect: This error may indicate that the docker daemon is not running.: Post "http://%2F%2F.%2Fpipe%d2Fdocker_engine/v1.24/containers/create?name=repo": open //./pipe/docker_enginer: The system cannot find the file specified.

I set com.docker.service to run in the Task Manager, and have run:

“c:\Program Files\Docker\Docker\DockerCli.exe” -SwitchDaemon

I have also quit Docker Desktop and reopened it in admin mode, and I still get the message that Docker Desktop has stopped.

Please let me know if there's any other options, thanks!

Alsatia answered 12/2, 2022 at 6:50 Comment(1)
What is your DockerDesktop version?Artiste
T
17

If you are running Docker Desktop for Windows 4.5.0 then you should be aware of an existing issue where the default backend selected after installing is not the correct one.

You can switch to the correct backend manually by editing the file located at: %AppData%\Docker\settings.json (full path: C:\Users\%UserName%\AppData\Roaming\Docker\settings.json) and at the bottom of the file change the value for the wslEngineEnabled field to true. After that Docker Desktop should start correctly.

Similar issue and solution is mentioned here by the user mccaa25.

Trutko answered 13/2, 2022 at 13:28 Comment(7)
For DockerDesktop 4.5.0 this is the accepted answer. Maybe the reason it was downvoted was because it is poorly written. I have tried to edit it but the edit queue is full. I would like only to add that this is a known issue because when I reached out to docker support they pointed me to the same solution. "Change wslEngineEnabled valueto true in the %APPDATA%\Docker\settings.json (sometimes is %APPDATA%\Roaming\Docker\settings.json) file"Artiste
Thanks! I added your clarifications in the main post. As this is my first StackOverflow answer, can you or someone tell me how it is poorly written?Trutko
"If you are running Docker Desktop for Windows 4.5.0 then you should be aware of an existing issue where the default backend selected after installing is not the correct one. You can wait for the release of Docker Desktop 4.5.1 and update after or meanwhile you can switch to the correct backend manually by editing the file located at: %APPDATA%\Docker\settings.json (sometimes is %APPDATA%\Roaming\Docker\settings.json) and at the bottom of the file change the value for the wslEngineEnabled field to true. After that Docker Desktop should start correctly".Artiste
In general answering directly with links is bad because you don't have control over them. Your approach to quote the solution was OK but a better one is trying to explain the solution in your own words and then just as a footnote referencing the GitHub page. See my example answer above.Artiste
Thank you very much for your time, this is much appreciated. Should I edit my post with your version? I don't want to be stealing your work, but it is indeed much better.Trutko
I have sent already an edit so we can wait if it's approvedArtiste
Looks like deleting the settings.json fixes the problem although mine is on Windows 10, after a windows update docker would not start the engine, the moment I end task all docker things and renamed settings.json then started docker desktop, it wanted to update from 4.19 to 4.20.1. I've had to do this in the past as well for another version where something in settings.json changed but was not updated automagically.Eulogize
P
39

I managed to solve the problem in this way:

  1. delete config file AppData/Roaming/Docker/settings.json
  2. start Docker Desktop (it will create new default settings.json)

You need to re-configure settings, so it is also good idea to save the old settings.json and compare settings with the new one.

Pickwickian answered 12/5, 2022 at 8:4 Comment(4)
Did not work for me using docker version 20.10.17, build 100c701Hotpress
Here at Windows 11 Education 22H2 (build 22621.819), I was finally able to launch Docker Desktop 4 (build 4.13.1-90346) after deleting %AppData%\Docker\settings.json. It was auto-created again during Docker startup and no container/image/volume was lost because of it. Thanks!Korns
In my case had to also run wsl --update as admin.Joliejoliet
Thank you Tiango Peres and Janne RantalaGauger
T
17

If you are running Docker Desktop for Windows 4.5.0 then you should be aware of an existing issue where the default backend selected after installing is not the correct one.

You can switch to the correct backend manually by editing the file located at: %AppData%\Docker\settings.json (full path: C:\Users\%UserName%\AppData\Roaming\Docker\settings.json) and at the bottom of the file change the value for the wslEngineEnabled field to true. After that Docker Desktop should start correctly.

Similar issue and solution is mentioned here by the user mccaa25.

Trutko answered 13/2, 2022 at 13:28 Comment(7)
For DockerDesktop 4.5.0 this is the accepted answer. Maybe the reason it was downvoted was because it is poorly written. I have tried to edit it but the edit queue is full. I would like only to add that this is a known issue because when I reached out to docker support they pointed me to the same solution. "Change wslEngineEnabled valueto true in the %APPDATA%\Docker\settings.json (sometimes is %APPDATA%\Roaming\Docker\settings.json) file"Artiste
Thanks! I added your clarifications in the main post. As this is my first StackOverflow answer, can you or someone tell me how it is poorly written?Trutko
"If you are running Docker Desktop for Windows 4.5.0 then you should be aware of an existing issue where the default backend selected after installing is not the correct one. You can wait for the release of Docker Desktop 4.5.1 and update after or meanwhile you can switch to the correct backend manually by editing the file located at: %APPDATA%\Docker\settings.json (sometimes is %APPDATA%\Roaming\Docker\settings.json) and at the bottom of the file change the value for the wslEngineEnabled field to true. After that Docker Desktop should start correctly".Artiste
In general answering directly with links is bad because you don't have control over them. Your approach to quote the solution was OK but a better one is trying to explain the solution in your own words and then just as a footnote referencing the GitHub page. See my example answer above.Artiste
Thank you very much for your time, this is much appreciated. Should I edit my post with your version? I don't want to be stealing your work, but it is indeed much better.Trutko
I have sent already an edit so we can wait if it's approvedArtiste
Looks like deleting the settings.json fixes the problem although mine is on Windows 10, after a windows update docker would not start the engine, the moment I end task all docker things and renamed settings.json then started docker desktop, it wanted to update from 4.19 to 4.20.1. I've had to do this in the past as well for another version where something in settings.json changed but was not updated automagically.Eulogize
G
11

latest version 4.5.0 It won't work for me too, for me downgrade to 4.4.4 it worked. It may be problem with the latest version

for released note and older version Here

Note: You can install an older version and update to latest version 4.5.0

Germann answered 13/2, 2022 at 0:11 Comment(3)
Yes, you are right. I installed 4.4.4 and then update 4.51 no problem. Thanks a lot.Flaky
U saved my days. 4.9.1 did not start for me but 4.4.4 ran without a problem. Wondering how docker guys test their product before releasing it in the world.Pointdevice
downgrade to 4.4.4 it works for me, thanks!Ioab
I
9

Wow! I spent multiple days trying to get Docker for windows 11 to work. What finally did it was downgrading to version 4.4.4 as @GinglrBell recommended. Here's a link Docker version 4.4.4.

Make sure WSL is installed and virtualization is enabled. If you try to open WSL and you get an error telling you to enable virtualization in BIOS, run this command as Admin in powershell: bcdedit /set hypervisorlaunchtype auto (Docker src). Then restart your PC.

Ivonneivor answered 13/2, 2022 at 5:15 Comment(0)
T
8

I hit this issue today, and the steps below are what worked for me - the gist is that I needed to install WSL 2 beforehand. Most of my steps were derived from here:

  1. open powershell as admin
  2. wsl -l -v # Windows Subsystem for Linux has no installed distributions
  3. Install linux kernel update from here # in my case, x64-based
  4. wsl --set-default-version 2
  5. wsl --l --online # shows several linux distributions, I picked a recent one
  6. wsl --install -d Ubuntu-20.04 # then create default linux user name and password
  7. Install windows docker desktop from here # now starts successfully
Targum answered 9/9, 2022 at 21:26 Comment(2)
One of installing the kernal update and setting default WSL version fixed for me on Windows 10 21H2Loader
thanks a lot, this works for me from the beginning.Gossoon
A
4

I solved this issue by enabling the windows feature "Windows Hypervisor Platform" and restarting my computer.

I installed Docker Desktop v4.16.2

Aggrade answered 27/1, 2023 at 22:40 Comment(0)
S
3

Manged to switch to Windows Containers. (Docker v4.9.0)

What I did was to change the following in the settings.json: "useWindowsContainers": true, "wslEngineEnabled": true,

Also set security on folder:

C:\ProgramData\Docker (I set "Everyone" full control.)

After that I used the "Switch to Windows Containers"-feature from the task-bar icon content menu

Sherlene answered 11/6, 2022 at 22:22 Comment(0)
A
2

I tried Janne Rantala's method.

But the same problem occurs again after several days.

My final solution is to uninstall Docker Desktop, then download and run the installation file as an administrator.

Then the problem no longer appears again.

Apodosis answered 30/9, 2022 at 8:53 Comment(0)
W
2

I was able to resolve this issue on my machine by installing the Linux kernel update package as described in the Microsoft guide

Wolk answered 17/1, 2023 at 18:27 Comment(1)
I've tried almost everything on the net and this is the only thing that made it work. Thanks!Horizontal
H
2

open cmd in administrator mode and enter:

wsl --update

Heavyweight answered 29/4 at 19:56 Comment(0)
A
0

I have been having some Docker setting up troubles for a fair amount of time. I think I had to just make sure I removed all references of Docker. After buying Windows 10 pro I still had issues, I did have to look into the following folders:

C:\Users\%UserName%\AppData\Local\Temp\Docker
C:\Users\%UserName%\AppData\Roaming\Docker

I also deleted the Docker file in my programfiles folder

Navigated to said file and deleted Docker files. Used the docker installer, checkboxes (to use wsl2).

Allyn answered 16/11, 2022 at 12:42 Comment(0)
V
0

I was faicing the same issue and resolved. I have just open Microsoft Store application and after that opened the docker and its working fine. This is wired but sharing this so it might helps someone.

Viscount answered 27/1, 2023 at 8:30 Comment(0)
N
0

I'm running Docker 4.21.0 on windows 11. In my case, I had to change the default distro to Ubuntu as my default was kali-linux.

The Docker-WSL integration is enabled on the default WSL distribution, which is Ubuntu. To change your default WSL distro, run:

wsl --set-default <distro name>

To check the WSL mode, run:

wsl.exe -l -v

Nunez answered 23/7, 2023 at 23:45 Comment(0)
L
0

I was facing this issue today while trying to run Docker desktop on a fresh installed Windows 11. I solved by installing Linux on Windows with WSL and then restarting the system. Follow the official Microsoft page here: How to install Linux on Windows with WSL

Lesotho answered 15/10, 2023 at 17:41 Comment(0)
L
0

For those having this problem on Azure: Nested virtualization needs to be enabled in Windows 11. Only specific Azure VMs support this, including the e-series.

Reference: https://learn.microsoft.com/en-us/azure/virtual-machines/easv5-eadsv5-series

Livengood answered 9/6 at 20:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.