Skip to content

Docker Startup problems Switching Docker to use WSL2 containers  #6822

Closed
@jcoconnor

Description

@jcoconnor
  • [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

Activity

jcoconnor

jcoconnor commented on May 21, 2020

@jcoconnor
Author

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

jcoconnor commented on May 21, 2020

@jcoconnor
Author

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

rfc1985

rfc1985 commented on May 27, 2020

@rfc1985

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

simonferquel commented on May 28, 2020

@simonferquel

@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

simonferquel commented on May 28, 2020

@simonferquel

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

rfc1985

rfc1985 commented on May 28, 2020

@rfc1985

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

jcoconnor commented on May 28, 2020

@jcoconnor
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

simonferquel commented on May 28, 2020

@simonferquel

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

rfc1985

rfc1985 commented on May 28, 2020

@rfc1985
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

simonferquel commented on May 28, 2020

@simonferquel

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

rfc1985 commented on May 28, 2020

@rfc1985

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

rfc1985

rfc1985 commented on May 28, 2020

@rfc1985

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

simonferquel commented on May 28, 2020

@simonferquel

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

benhillis

benhillis commented on May 28, 2020

@benhillis

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

comedinha

comedinha commented on May 28, 2020

@comedinha

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

8 remaining items

blue7wings

blue7wings commented on Jun 10, 2020

@blue7wings

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

exkalation commented on Jun 11, 2020

@exkalation

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

IITII commented on Jun 13, 2020

@IITII

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

jkonowitch commented on Jun 15, 2020

@jkonowitch

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

JimNolan

JimNolan commented on Jun 23, 2020

@JimNolan

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

StoneyEagle

StoneyEagle commented on Jul 18, 2020

@StoneyEagle

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

Dennis-Petrov commented on Jul 22, 2020

@Dennis-Petrov

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

mwalol

mwalol commented on Jul 22, 2020

@mwalol

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

gondaz

gondaz commented on Aug 4, 2020

@gondaz

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

docker-robott commented on Nov 3, 2020

@docker-robott
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

docker-robott commented on Jan 2, 2021

@docker-robott
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

locked and limited conversation to collaborators on Jan 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @adrianmoya@exkalation@jkonowitch@RichardSilveira@simonferquel

        Issue actions

          Docker Startup problems Switching Docker to use WSL2 containers · Issue #6822 · docker/for-win