Reputation: 1282
My docker environment was working fine. I restarted my system and it stopped unexpectedly. whenever I try to start docker it throws the following error
WSL 2 integration with distro Ubuntu 20.04 unexpectedly stopped with exit code 1.
I am using the following versions
I have tried following patterns to make it run
Upvotes: 29
Views: 69652
Reputation: 611
Here's what worked for me after try almost every suggesstion above without success.
I checked docker desktop Settings -> Resources -> WSL Integration, and found there was no distribution listed.
Next step is to confirm what distributions I have installed and what version they were. Using wsl.exe -l -v
in windows terminal will help you do that.
From the list I found that my Ubuntu-24.04 was listed as Version 1.
Then, I ran this command to upgrade it to version 2.
wsl.exe --set-version Ubuntu-24.04 2
Took a few minutes and it was done.
I returned to Docker desktop settings under Wsl Integration, and refreshed the distros list.
Now, I can see the Ubuntu listed here. All I did here was to toggle it on, and clicked apply.
That solved the issue for me.
Upvotes: 13
Reputation: 21
After upgrading to v4.37.1 and facing this same issue, I ran wsl --update
Still facing the same issue, I unchecked 'Enable integration with my default distro"
My Docker displays : "You don't have any WSL 2 distros installed. Please convert a WSL 1 distro to WSL 2, or install a new distro and it will appear here."
Upvotes: 0
Reputation: 34
If you encounter the same issue, and after trying every solution from the internet, the problem persisted, then all you need to do is update Docker Desktop, and it will run flawlessly issue in this image
Upvotes: 0
Reputation: 1
I have also removed C:/Windows/System32 from the Path variables and this has caused this problem to me. Try to add the folder "C:/Windows/System32" to PATH and try again starting the Ubuntu distribution and also Docker Engine will be able to start again.
Upvotes: 0
Reputation: 24
For someone who cannot found any solutions. My problem was unabled to access to wsl network system from windows expolorer directly but powershell wsl command nicely
https://learn.microsoft.com/en-us/answers/questions/602778/windows-11-does-not-read-linux-tree
link info ref (
The solution was to use the Registry Editor (regedit.msc) to edit
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order
and change it to
P9NP,cbfsconnect2017,RDPNP,LanmanWorkstation,webclient,wsauth
)
After that problem was solved for me...
Upvotes: 0
Reputation: 2680
Contrary to other answers, my issue was due to a buggy WSL update (a pre-release version). Rolling back to an older version resolved the issue:
wsl
using: wsl --version
. For example, at the time of writing, version 2.3.11 was problematic and a revert back to 2.2.4 was necessary.wsl
using the following command: wsl --uninstall
. You will not loose your distros..msixbundle
unless you had previously installed it manually using a normal installer.You may use this answer in combination with other ones here if needed but this should be enough.
Edit: Try the solution provided by @AndrewKeller below as it might save you from the hustle of reverting back to an older version.
Upvotes: 1
Reputation: 3239
Thanks to @Ziad Akiki for pointing me in the right direction with his answer. I confirmed that my WSL too had been upgraded to 2.3.11.0, but after digging through a few of the related issues on the WSL github I found this solution, which fixed the issue for me by enabling systemd without requiring rolling back to an older version. I shutdown Docker Desktop before following these steps.
wsl
/etc/wsl.conf
(it may not exist): sudo vi /etc/wsl.conf
i
to insert first):[boot]
systemd=true
esc
then :wq
)exit
wsl --shutdown
wsl
Docker desktop should now be able to start again!
Upvotes: 1
Reputation: 1
I got this problem due to local firewall, disabling the firewall solved the issue.
Upvotes: 0
Reputation: 205
i did on powershell as admin :
sc.exe config wslservice start= demand
wsl --install
Upvotes: 0
Reputation: 31
I had byobu enabled (on Ubuntu-24.04). Running byobu-disable
immediately solved the issue with Docker Desktop integration.
Upvotes: 0
Reputation: 1
tldr: Turn off Resource Saver when debugging
I hope this helps someone avoid my pain...
While debugging the issue above, matter what I did,docker ps
would output
We recommend to activate the WSL integration in Docker Desktop settings.
For details about using Docker Desktop with WSL 2, visit:
https://docs.docker.com/go/wsl2/
Then I turned off Resources->Advanced->Resource Saver in docker desktop and it fixed it. Screenshot of Docker Desktop settings menu
My underlying issue was similar to Manuel Pacheco mounts, but when debugging with no containers running I found that Resource Saver would cause docker ps not to work even after I removed the mounts file.
Upvotes: 0
Reputation: 138
In Docker Desktop Settings:
If you get the error again just keep clicking restart.
Upvotes: 0
Reputation: 1
My situation was that I move my WSL ext4.vhdx file to another PC. To resolve this issue I had to set a default user to WSL using this command because by default its root :
ubuntu config --default-user <username>
Upvotes: 0
Reputation: 434
My user folder had root:root
ownership.
I ran sudo chown -R david:david david
(david is my username). So it was a permission issue.
Seems like there's a lot of reasons why this happens.
Upvotes: 2
Reputation: 330
Try these commands if you're willing to risk losing the data:
wsl --unregister docker-desktop
wsl --unregister docker-desktop-data
Upvotes: 26
Reputation: 1
I had the exact same error when Docker desktop was attempting to start.
Below are some attempts I made to resolve the issue with no outcome:
wsl --shutdown
wsl --update
& wsl.exe --update --pre-release
Get-Service LxssManager | Restart-Service
NB: All the above commands were run in Powershell with administrative rights.
After 2 days, this worked for me.
.wslconfig
file I added to the path C:\Users\<username>
I added this file to limit the insane amounts of memory Docker was consuming on WSL2. More details here
After I updated Docker to v4.18.0
it appears that the applied memory allocation constrained the new update from launching.
Once I deleted the .wslconfig
file, Docker started smoothly.
Version details for my machine:
10 Pro - Version 22H2 (OS Build 19045.2846)
1.2.1.0
v4.18.0
Upvotes: 0
Reputation: 5385
This has happened to me a few times, and in many cases it was because I needed to update to a new version of WSL e.g. run the following in Powershell:
PS C:\Users\Me> wsl --update
Checking for updates.
Updating Windows Subsystem for Linux.
PS C:\Users\Me> wsl -v -l
WSL version: 1.2.0.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.2728
Upvotes: 1
Reputation: 41
Just posting what worked for me. I was using a WSL distro that I restored from a previous Windows installation (named here ubuntu-restore
).
Initially, I was able to get more information to debug my problem by running:
sudo /mnt/wsl/docker-desktop/docker-desktop-user-distro proxy --distro-name ubuntu-restore
And the console gave the following error (simplified):
[docker-desktop-user-distro in ubuntu-restore][I] mounting /mnt/c/Users/no-longer-exists to /mnt/wsl/docker-desktop-bind-mounts/ubuntu-restore/b34c91da7c9e60d4983f67b84fe84fda955dbf79d010eb25ab0aaec28012fb5c
[docker-desktop-user-distro in ubuntu-restore][W] restoreMounts: ensure ready failed: mkdir /mnt/c/Users/no-longer-exists: permission denied
Which meant I had to clean up some old bind mounts that stayed in the distro. I found them in /var/lib/docker-desktop/mounts.data
, removed them, and the WSL integration works again.
Upvotes: 4
Reputation: 141
Check for a system variable
Path - C:\Windows\System32
Maybe it will save you a few hours.
Upvotes: 14
Reputation: 1
I tried every answer here but when I'm starting docker was still facing the same issue.
So I started the docker without WSL after installation, then changed the setting to use WSL. Docker is working fine now. Hope this helps someone.
Upvotes: 0
Reputation: 41
Have the same problem. It solved after I add 'C:\Windows\System32' to path.
Try type wsl.exe or wslconfig.exe /l. If nothing happens than modify the path.
Upvotes: 2
Reputation: 6967
Unfortunately none of the solutions here worked for me. Steps to fix were:
sudo apt update
sudo apt upgrade
Note that containers and volumes were lost with the uninstall.
Upvotes: 6
Reputation: 343
I had the same issue when updated docker desktop with WSL2 backed has a work around I did the following steps:
Hope this helps!
Upvotes: 17
Reputation: 159
Please try this solution comes from todpale:
net stop LxssManager && net start LxssManager
You also may check if your distro is enabled in Docker settings (General tab and Resources tab -> WSL Integration).
There is a discussion about this issue on Github https://github.com/docker/for-win/issues/9972
Upvotes: 3