Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Startup problems Switching Docker to use WSL2 containers #6822

Closed
jcoconnor opened this issue May 21, 2020 · 33 comments
Closed

Docker Startup problems Switching Docker to use WSL2 containers #6822

jcoconnor opened this issue May 21, 2020 · 33 comments

Comments

@jcoconnor
Copy link

  • [X ] I have tried with the latest version of my channel (Stable or Edge)
  • [ X] I have uploaded Diagnostics
  • Diagnostics ID: CB3B5F00-CC2A-4D76-8AD4-A84151BE59A1/20200521112149

Expected behavior

Expect Docker to start.

Actual behavior

ts crashing each time I attempt to start it after selecting the new option to use WSL2 containers on Windows 10 (Build 2004 - Insider build).

Information

Startup Error produced by Docker

System.IO.IOException:
The process cannot access the file 'C:\Users\john.oconnor\AppData\Local\Docker\vm-config\config.iso' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalDelete(String path, Boolean checkHost)
   at Docker.Engines.IsoConfig.DeleteIso() in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\IsoConfig.cs:line 220
   at Docker.Engines.IsoConfig.CreateIso(Settings settings, JObject jsonConfig, Boolean rawJson) in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\IsoConfig.cs:line 112
   at Docker.Engines.WSL2.WSL2Configurator.PrepareConfiguration(Settings settings) in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\WSL2Configurator.cs:line 19
   at Docker.Engines.WSL2.LinuxWSL2Engine.<DoStartAsync>d__23.MoveNext() in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\LinuxWSL2Engine.cs:line 98
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.ApiServices.StateMachines.TaskExtensions.<WrapAsyncInCancellationException>d__0.MoveNext() in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\TaskExtensions.cs:line 29
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 67
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() in C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:line 92

Steps to reproduce the behavior

  1. Start Docker Desktop
@jcoconnor
Copy link
Author

jcoconnor commented May 21, 2020

So - tried uninstalling and re-installing Docker Desktop - different error this time.
See Also #6727

WSL distro stopped while waiting for Lifecycle server.
  >Stdout:

  >Stderr:
2020/05/21 11:47:27 resolving /mnt/host/c/Program Files/Docker/Docker/resources/wsl/docker-wsl-cli.iso...
2020/05/21 11:47:27 copying...
Error: mounting wslCLIDest: open /mnt/host/wsl/docker-desktop-data/isocache/d54eeebb9348d7c5c43c25783d6887cf89ae8a4067225181eab307353aac92fe.iso: input/output error
2020/05/21 11:47:27 open /mnt/host/wsl/docker-desktop-data/isocache/d54eeebb9348d7c5c43c25783d6887cf89ae8a4067225181eab307353aac92fe.iso: input/output error
mounting wslCLIDest
main.doRun
	/go/src/github.com/docker/pinata/linuxkit/pkg/wsl-bootstrap/main.go:229
main.run.func1
	/go/src/github.com/docker/pinata/linuxkit/pkg/wsl-bootstrap/main.go:84
github.com/docker/pinata/vendor/github.com/spf13/cobra.(*Command).execute
	/go/src/github.com/docker/pinata/vendor/github.com/spf13/cobra/command.go:762
github.com/docker/pinata/vendor/github.com/spf13/cobra.(*Command).ExecuteC
	/go/src/github.com/docker/pinata/vendor/github.com/spf13/cobra/command.go:852
github.com/docker/pinata/vendor/github.com/spf13/cobra.(*Command).Execute
	/go/src/github.com/docker/pinata/vendor/github.com/spf13/cobra/command.go:800
main.main
	/go/src/github.com/docker/pinata/linuxkit/pkg/wsl-bootstrap/main.go:26
runtime.main
	/usr/local/go/src/runtime/proc.go:203
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1357

@jcoconnor
Copy link
Author

3rd time luck - docker started this time and I'm able to run containers.
All working again.

@rfc1985
Copy link

rfc1985 commented May 27, 2020

Same issue after update to build 2004 (19628).

Tried to reinstall stable/edge version of docker multiple times with same result.

Steps already tried:

Pressed button "reset to factory default" multiple times
Unregistered wsl distros and done a clean installation of wsl2.

Only if I deactivate "Use the WSL 2 based engine", the docker does not crash.
But the wsl2 feature cannot be used as expected.

Error message:

`WSL distro stopped while waiting for Lifecycle server.

Stdout:

Stderr:
2020/05/27 20:01:37 resolving /mnt/host/c/Program Files/Docker/Docker/resources/wsl/docker-wsl-cli.iso...
Error: mounting wslCLIDest: stat /mnt/host/c/Program Files/Docker/Docker/resources/wsl/docker-wsl-cli.iso: no such file or directory
2020/05/27 20:01:37 stat /mnt/host/c/Program Files/Docker/Docker/resources/wsl/docker-wsl-cli.iso: no such file or directory
mounting wslCLIDest
main.doRun
/go/src/github.com/docker/pinata/linuxkit/pkg/wsl-bootstrap/main.go:224
main.run.func1
/go/src/github.com/docker/pinata/linuxkit/pkg/wsl-bootstrap/main.go:83
github.com/docker/pinata/vendor/github.com/spf13/cobra.(*Command).execute
/go/src/github.com/docker/pinata/vendor/github.com/spf13/cobra/command.go:838
github.com/docker/pinata/vendor/github.com/spf13/cobra.(*Command).ExecuteC
/go/src/github.com/docker/pinata/vendor/github.com/spf13/cobra/command.go:943
github.com/docker/pinata/vendor/github.com/spf13/cobra.(*Command).Execute
/go/src/github.com/docker/pinata/vendor/github.com/spf13/cobra/command.go:883
main.main
/go/src/github.com/docker/pinata/linuxkit/pkg/wsl-bootstrap/main.go:25
runtime.main
/usr/local/go/src/runtime/proc.go:203
runtime.goexit
/usr/local/go/src/runtime/asm_amd64.s:1373`

@simonferquel
Copy link

@jcoconnor sorry about those crashes.

  • The first one seem to be an related to the switch to WSL2 incorrectly living the Hyper-V backend VM alive. I'll work on a patch right away
  • The second is a bug in WSL 2 itself (this input/output error means something went wrong in wsl and the docker-desktop-data disto VHD may have been unmounted)

@rfc1985 can you send me a diagnostic ? for some reason, some necessary files necessary for WSL 2 are not reachable at the expected location from the wsl distro.

@simonferquel
Copy link

see Error: mounting wslCLIDest: stat /mnt/host/c/Program Files/Docker/Docker/resources/wsl/docker-wsl-cli.iso: no such file or directory.

@rfc1985
Copy link

rfc1985 commented May 28, 2020

Hi @simonferquel
here the diagnostic ID: 251936C6-FF59-4063-BF06-A62A76EF5D38/20200528093614
docker_start_failed

The Docker is installed in "C:\Program Files\Docker"
Docker so file is located in same path: "C:\Program Files\Docker\Docker\resources\wsl\docker-wsl-cli.iso"

It seems to be that the docker mount is failing.
If I open the path "\wsl$\docker-desktop\mnt\host\c" there is no content inside it.

Can I configure the docker mount somewhere?

@jcoconnor
Copy link
Author

@simonferquel

Thanks for the update - as I indicated - I was able to get it working after a few attempts and its been working fine ever since.

But good to see that you are sorting a patch on it as well 👍

@simonferquel
Copy link

@rfc1985 can you show me the output of wsl -d docker-desktop cat /proc/self/mountinfo ?

@rfc1985
Copy link

rfc1985 commented May 28, 2020

An error occurred mounting one of your file systems. Please run 'dmesg' for more details.

73 64 8:16 / / rw,relatime - ext4 /dev/sdb rw,discard,errors=remount-ro,data=ordered
74 73 0:20 /init /init ro,relatime - 9p tools ro,dirsync,aname=tools;fmask=022,loose,access=client,trans=fd,rfd=6,wfd=6
75 73 0:6 / /dev rw,nosuid,relatime - devtmpfs none rw,size=13060096k,nr_inodes=3265024,mode=755
76 75 0:24 / /dev/pts rw,nosuid,noexec,noatime - devpts devpts rw,gid=5,mode=620,ptmxmode=000
77 73 0:16 / /sys rw,nosuid,nodev,noexec,noatime - sysfs sysfs rw
78 77 0:29 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime - tmpfs tmpfs rw,mode=755
79 78 0:30 / /sys/fs/cgroup/unified rw,nosuid,nodev,noexec,relatime - cgroup2 cgroup2 rw,nsdelegate
80 78 0:31 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuset
81 78 0:32 / /sys/fs/cgroup/cpu rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpu
82 78 0:33 / /sys/fs/cgroup/cpuacct rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,cpuacct
83 78 0:34 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,blkio
84 78 0:18 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,memory
85 78 0:35 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,devices
86 78 0:36 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,freezer
87 78 0:37 / /sys/fs/cgroup/net_cls rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,net_cls
88 78 0:38 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,perf_event
89 78 0:39 / /sys/fs/cgroup/net_prio rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,net_prio
90 78 0:40 / /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,hugetlb
91 78 0:41 / /sys/fs/cgroup/pids rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,pids
92 78 0:42 / /sys/fs/cgroup/rdma rw,nosuid,nodev,noexec,relatime - cgroup cgroup rw,rdma
93 73 0:23 / /proc rw,nosuid,nodev,noexec,noatime - proc proc rw
94 93 0:21 / /proc/sys/fs/binfmt_misc rw,relatime - binfmt_misc binfmt_misc rw
95 73 0:25 / /run rw,nosuid,noexec,noatime - tmpfs none rw,mode=755
96 95 0:26 / /run/lock rw,nosuid,nodev,noexec,noatime - tmpfs none rw
97 95 0:27 / /run/shm rw,nosuid,nodev,noatime - tmpfs none rw
98 95 0:28 / /run/user rw,nosuid,nodev,noexec,noatime - tmpfs none rw,mode=755
99 73 0:19 / /mnt/host/wsl rw,relatime shared:1 - tmpfs tmpfs rw

@simonferquel
Copy link

Ok, from this output, it seems that wsl2 failed to mount your Windows drives (you can see the first line saying it).
Can you run wsl.exe -u root dmesg ? You might find interesting things in those logs.

@rfc1985
Copy link

rfc1985 commented May 28, 2020

Nothing special.
[ 0.081311] Microsoft 4.4.0-19628.1-Microsoft 4.4.35

@rfc1985
Copy link

rfc1985 commented May 28, 2020

I have a fix for the mount issue inside my Ubuntu-18.04 WSL2 by mount the drives manually after boot up.
Unfortunately I can't do this for windows docker, because it crashes at start.

@simonferquel
Copy link

@benhillis any clue about why Windows files fail to mount ?

@benhillis
Copy link

@simonferquel - yes, we have some fixes inbound to Insider builds. 2004 should not be affected.

@comedinha
Copy link

I formatted the computer and the problem persists.
Few seconds after receive this problem the machine crash with error: HYPERVISOR_ERROR

@adrianmoya
Copy link

I just updated to windows 2004 and hit this error. I installed the wsl2 kernel and now docker doesn't start.

System.IO.IOException: El proceso no puede obtener acceso al archivo 'C:\Users\AMoyaGuzman\AppData\Local\Docker\vm-config\config.iso' porque está siendo utilizado en otro proceso. en System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) en System.IO.File.InternalDelete(String path, Boolean checkHost) en Docker.Engines.IsoConfig.DeleteIso() en C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\IsoConfig.cs:línea 220 en Docker.Engines.IsoConfig.CreateIso(Settings settings, JObject jsonConfig, Boolean rawJson) en C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\IsoConfig.cs:línea 112 en Docker.Engines.WSL2.WSL2Configurator.PrepareConfiguration(Settings settings) en C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\WSL2Configurator.cs:línea 19 en Docker.Engines.WSL2.LinuxWSL2Engine.<DoStartAsync>d__23.MoveNext() en C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\WSL2\LinuxWSL2Engine.cs:línea 98 --- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción --- en System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) en Docker.ApiServices.StateMachines.TaskExtensions.<WrapAsyncInCancellationException>d__0.MoveNext() en C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\TaskExtensions.cs:línea 29 --- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción --- en System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() en System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) en Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() en C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:línea 67 --- Fin del seguimiento de la pila de la ubicación anterior donde se produjo la excepción --- en System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() en Docker.ApiServices.StateMachines.StartTransition.<DoRunAsync>d__5.MoveNext() en C:\workspaces\stable-2.3.x\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\StartTransition.cs:línea 92

@rfc1985
Copy link

rfc1985 commented May 29, 2020

@benhillis will the mount fix be listed in next insider preview releases?
ATM I have the 19628.1.

@djechelon
Copy link

Please use Diagnostics ID: 71C92EEB-7D59-41A6-8E87-8B9B0108F0A8/20200529112950 if useful

@supervas
Copy link

supervas commented Jun 2, 2020

In my case the problem was caused because the HyperV VM "DockerDesktopVM" was running. After shutting down the Docker Desktop VM works properly again through WSL2.

@adrianmoya
Copy link

Turning off and deleting the "DockerDesktopVM" in hyper-V did the trick. Thanks @supervas

@RichardSilveira
Copy link

Shutdown DockerDesktopVM from Hyper-V Manager worked for me too, thanks @supervas

@ricksolis
Copy link

I was getting the same error -- Error: mounting wslCLIDest:

I restarted Docker for Windows.
I tried to reset to factory defaults .. but the error persisted.

This is what fixed Docker for me -- I stoppped and restarted the Hyper-V Manager service.
As suggested by others, I went to the Hyper-V Manager to delete the "DockerDesktopVM", but I didn't have any VMs. So I stopped the service and then restarted Docker -- It worked !

@blue7wings
Copy link

In my case the problem was caused because the HyperV VM "DockerDesktopVM" was running. After shutting down the Docker Desktop VM works properly again through WSL2.

thank you man, I shutdown and delete DockerDesktopVM from Hyper-V Manager , and restart Docker, everything is ok.

@exkalation
Copy link

I just experienced the same error right after Windows startup. After opening a WSL2 Ubuntu terminal, starting Docker Desktop worked. Just in case somebody might find this helpful.

@IITII
Copy link

IITII commented Jun 13, 2020

My ENV
Win10 2004 build 19041
docker version: 2.3.0.3(45519) stable
wsl2 ubuntu1804

I simplely resolve this problem by following steps:

  1. quit docker desktop
  2. stop docker service in service.msc which should be called com.docker.service
  3. shutdown wsl: wsl --shutdown
  4. start wsl by click the icons(maybe this step is not necessary)
  5. start docker windows
  • Maybe you will get the same issue after reboot windows, beacuse of using Expose Daemon on tcp://lcoalhost:2375 without tls.
  • For this special case, Reset docker to factory defaults or Reinstall docker will fix it.
  • In tech, modify the config file and restart docker is also helpful.

Honestly, I don't know where is the config file when using docker for windows in WSL2.
Maybe one of following, maybe not🤔
Win ~/AppData/Roaming/Docker/settings.json
Win ~/.docker/*.json

Good luck.

@jkonowitch
Copy link

Following @IITII 's steps fixed the issue for me.

@JimNolan
Copy link

I "ejected" the virtual dvd created during the docker installation and then re-ran startup and it ran fine.

@StoneyEagle
Copy link

I just ran into this issue and the options above did not solve my issue.
I had to use a program that is capable of unlocking files and deleting files on reboot.
Lockhunter will let you force delete the config file and allows you to start docker.
I have ben using this program for docker for a while since docker likes to lock files that i am working with.. even mounted files and folders.

Hope this helps anyone.

@Dennis-Petrov
Copy link

Greetings.
The same issue.
Diagnostic ID: 7F3EE248-FF03-4D3D-B0C3-6A2ED025AC5F/20200722073734

@mwalol
Copy link

mwalol commented Jul 22, 2020

i just reinstalled the package to fix this issue after the upgrade.

@gondaz
Copy link

gondaz commented Aug 4, 2020

For all the googlers who bumped into the same issue with a WSL2/Docker stack, try to follow the steps that mentioned by @IITII above.
That worked like a magic for me, too. Thank you!

@docker-robott
Copy link
Collaborator

Issues go stale after 90 days of inactivity.
Mark the issue as fresh with /remove-lifecycle stale comment.
Stale issues will be closed after an additional 30 days of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle stale

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows.
/lifecycle locked

@docker docker locked and limited conversation to collaborators Jan 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests