[WSL2] Docker startup fails with "wsl exited with code -1"
- [x] I have tried with the latest version of my channel (Stable or Edge)
- [x] I have uploaded Diagnostics
- Diagnostics ID: 83925FF1-D3EE-4CBF-A54A-68AC6D60F69F/20191202151149
Expected behavior
Docker engine should start in default WSL 2 distribution.
Actual behavior
Docker engine fails to start with the following error:
wsl exited with code -1. Stderr is:
at Docker.Backend.ContainerEngine.WslEngine.DeployDistro(String name, String source, String destinationDir)
at Docker.Backend.ContainerEngine.WslEngine.DoStart(Settings settings, String daemonOptions, Credential credential)
at Docker.Backend.ContainerEngine.WslEngine.Start(Settings settings, String daemonOptions, Credential credential, Boolean retry)
at Docker.Backend.ContainerEngine.WslEngine.Start(Settings settings, String daemonOptions, Credential credential, Boolean retry)
at Docker.Backend.ContainerEngine.WslEngine.Start(Settings settings, String daemonOptions, Credential credential)
at Docker.Backend.BackendNamedPipeServer.<Run>b__8_2(Object[] args)
at Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass9_0.<Register>b__0(Object[] parameters)
at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)
Essentially the same as issue #5097 which is closed but the provided workaround (reinstalling WSL distribution) is neither working nor acceptable.
Information
- Windows Version: 10.0.19033.1
- Docker Desktop Version: 2.1.6.1
- Are you running inside a virtualized Windows e.g. on a cloud server or on a mac VM: No
>wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 2
Can you try in powershell (as current user, not elevated):
cd ~/
mkdir docker-desktop-test
wsl --import docker-desktop-test .\docker-desktop-test\ 'C:\Program Files\Docker\Docker\resources\wsl\wsl-bootstrap.tar' --version=2
and report the result of this invocation ?
@simonferquel I'm getting the same error from 2.1.6.1. I ran your commands above as my regular user, and I got no output - the wsl command appeared to execute successfully, there was no output, and Powershell went back to the prompt.
@simonferquel I have the diagnostics .zip file. Let me know how to send it if you want it, please.
Unfortunately 2.1.6.1 does not capture detailed output from wsl.exe (because wsl.exe sometimes send errors on stderr, sometimes stdout, sometimes in utf8 and sometimes in utf16 depending on the context). Next build will help us diagnose these errors and get a better understanding. I'll send you a link to a custom (not-production ready) build tomorrow. If you have time to try to run it and run a diagnostic with it if it fails, I' d be very grateful!
@verglor, @eblount here is the "experimental build" for you to test: https://download-stage.docker.com/win/edge/41367/Docker%20Desktop%20Installer.exe (diagnostics coming from this build are much more detailed, and even the bug report window should present the output of the wsl commands we issue in both utf8 and utf16)
Hi, @simonferquel, after installing "experimental build" 2.1.7.0 the error changed to:
Failed to deploy distro docker-desktop to C:\Users\jako\AppData\Local\Docker\wsl\distro: exit code: -1
stdout(utf8): The operation timed out because a response was not received from the virtual machine or container.
stdout(unicode): The operation timed out because a response was not received from the virtual machine or container.
stderr (utf8):
stderr (unicode):
at Docker.Backend.ContainerEngine.WslEngine.WslOneShotResult.LogAndThrowIfUnexpectedExitCode(String prefix, ILogger log, Int32 expectedExitCode)
at Docker.Backend.ContainerEngine.WslEngine.DeployDistro(String name, String source, String destinationDir)
at Docker.Backend.ContainerEngine.WslEngine.DoStart(Settings settings, String daemonOptions, Credential credential)
at Docker.Backend.ContainerEngine.WslEngine.Start(Settings settings, String daemonOptions, Credential credential, Boolean retry)
at Docker.Backend.ContainerEngine.WslEngine.Start(Settings settings, String daemonOptions, Credential credential, Boolean retry)
at Docker.Backend.ContainerEngine.WslEngine.Start(Settings settings, String daemonOptions, Credential credential)
at Docker.Backend.BackendNamedPipeServer.<Run>b__8_2(Object[] args)
at Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass9_0.<Register>b__0(Object[] parameters)
at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters)
New diagnostic ID: 83925FF1-D3EE-4CBF-A54A-68AC6D60F69F/20191203122331
Result of invoking wsl --import docker-desktop-test .\docker-desktop-test\ 'C:\Program Files\Docker\Docker\resources\wsl\wsl-bootstrap.tar' --version=2 is still empty. (I have unregistered previous docker-desktop-test before running it)
Do commands such as wsl -l -v succeed ?
@simonferquel - Yes:
> wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 2
docker-desktop-test Stopped 2
Can you check if C:\Users\jako\AppData\Local\Docker\wsl\distro is empty ?
@simonferquel - Yes, it's empty
Hmm, can you try to run wsl --import docker-desktop C:\Users\jako\AppData\Local\Docker\wsl\distro 'C:\Program Files\Docker\Docker\resources\wsl\wsl-bootstrap.tar' --version=2? and if it fails:
mkdir c:\Users\jako\custom-docker-desktop
wsl --import docker-desktop c:\Users\jako\custom-docker-desktop 'C:\Program Files\Docker\Docker\resources\wsl\wsl-bootstrap.tar' --version=2
and restart docker-desktop ?
@simonferquel
C:\Users\jako> wsl --import docker-desktop C:\Users\jako\AppData\Local\Docker\wsl\distro 'C:\Program Files\Docker\Docker\resources\wsl\wsl-bootstrap.tar' --version=2
The operation timed out because a response was not received from the virtual machine or container.
C:\Users\jako> mkdir c:\Users\jako\custom-docker-desktop
Directory: C:\Users\jako
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 3. 12. 2019 13:54 custom-docker-desktop
C:\Users\jako> wsl --import docker-desktop c:\Users\jako\custom-docker-desktop 'C:\Program Files\Docker\Docker\resources\wsl\wsl-bootstrap.tar' --version=2
C:\Users\jako> wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 2
docker-desktop Running 2
docker-desktop-test Stopped 2
After restarting docker desktop, first line of error changed to Failed to deploy distro docker-desktop-data to C:\Users\jako\AppData\Local\Docker\wsl\data: exit code: -1
New diagnostic ID: 83925FF1-D3EE-4CBF-A54A-68AC6D60F69F/20191203130148
Can you check in windows explorer if C:\Users\jako\AppData\Local\Docker\wsl\distro has compress or encrypt attributes ? (right click, properties, advanced an check the 2 attributes at the bottom of the window)
It had compress attribute, but it does not work even after I disabled compression on whole %LOCALAPPDATA%\Docker folder and subfolders...
I even tried it with newly created %LOCALAPPDATA%\Docker\wsl\distro2 and it works - only %LOCALAPPDATA%\Docker\wsl\distro has problem.
@simonferquel - It's working now ! I needed to restart computer after disabling compression on %LOCALAPPDATA%\Docker.
Ok, nice to know. I'll make sure we disable compression/encryption on our distro deployment folders. Thanks!
I tried to reenable compression on %LOCALAPPDATA%\Docker folder and error came back, so it is definitely the compression problem.
@simonferquel I was late to the party this morning, so I decided to just try disabling compression on AppData\Local\Docker, and that worked fine for 2.1.6.1! It did require a restart, as @verglor said.
@simonferquel Is it actually possible to prevent Windows to automatically compress specific folder without disabling compression globally ?
I think that once you explicitly disable compression on a folder, it won't recompress it