docker / for-win

Bug reports for Docker Desktop for Windows
https://www.docker.com/products/docker#/windows
1.86k stars 290 forks source link

wrong mount path in WSL for Docker Desktop installed in Program Files #13318

Open ThePlenkov opened 1 year ago

ThePlenkov commented 1 year ago

Actual behavior

With docker Desktop for Windows installed I go to WSL and run there mount command Among all mounts I will a line there:

drvfs on /Docker/host type 9p (rw,noatime,dirsync,aname=drvfs;path=C:\Program)

This is wrong mapping

Expected behavior

This command should return full path. I expect that space should be escaped somehow in wsl for docker path

Information

docker -v
Docker version 20.10.23, build 7155243
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:        22.04
Codename:       jammy
cat /proc/self/mountinfo
2260 190 0:311 / /Docker/host rw,noatime - 9p drvfs rw,dirsync,aname=drvfs;path=C:\Program Files\Docker\Docker\resources;symlinkroot=/mnt/,mmap,access=client,msize=262144,trans=virtio
ThePlenkov commented 1 year ago

I found this issue when I was troubleshooting snap command and utilities installed with snap.

any command gives me something like this:

hello-world
2023/03/20 17:20:15.374722 system_key.go:129: cannot determine nfs usage in generateSystemKey: cannot parse mountinfo: incorrect number of tail fields, expected 3 but found 4
2023/03/20 17:20:15.384788 cmd_run.go:1046: WARNING: cannot create user data directory: cannot determine SELinux status: failed to obtain SELinux mount path: incorrect number of tail fields, expected 3 but found 4
Hello World!`

Small reverse engineering results lead here: // cannot create user data directory https://github.com/snapcore/snapd/blob/master/cmd/snap/cmd_run.go#LL1046C5-L1046C5 // failed to obtain SELinux mount path https://github.com/snapcore/snapd/blob/master/cmd/snap/cmd_run.go#L435 // failed to obtain SELinux mount path https://github.com/snapcore/snapd/blob/master/sandbox/selinux/selinux_linux.go#L33 // incorrect number of tail fields, expected 3 but found 4 https://github.com/snapcore/snapd/blob/master/osutil/mountinfo_linux.go#L190

Indeed - the error is raised in a thirdparty tool snap. But the fact that mount info contains invalid entry - this is not good and controlled on the docker desktop side.

ThePlenkov commented 1 year ago

Ok - I just reinstalled to C:\Docker and now I have this:

drvfs on /Docker/host type 9p (rw,noatime,dirsync,aname=drvfs;path=C:\Docker\resources;symlinkroot=/mnt/,mmap,access=client,msize=262144,trans=virtio)

So my suggestion was correct. Right after this snap started working properly

kindtek commented 1 year ago

wow great work! I had the same problem and your suggestion fixed it. for anyone else who finds this, I used CMD to run the following command to install to C:\Docker "Docker Desktop Installer.exe" install --accept-license --installation-dir=C:\Docker

for some reason the powershell script given on documentation is not accepting arguments

ThePlenkov commented 1 year ago

Additionally I've also created a proposal #13319 to support propagating location from winget

ErikSchierboom commented 1 year ago

The above is a nice workaround, but ideally it should be fixed upstream.

kindtek commented 1 year ago

for whatever reason, the problem is getting worse. I can no longer use the CMD hack to choose an install location. I am considering starting a whole new issue for just this problem but for now I will keep it here. fwiw here is the log from when I tried (and failed) installing to C:\Docker using CMD

(the powershell script as noted earlier still fails to accept arguments altogether)

C:\Users\XXXXXXXXXXXXXXXX\Downloads>"Docker Desktop Installer.exe" install --accept-license --backend=wsl-2 installation-dir=C:\Docker

C:\Users\XXXXXXXXXXXXXXXX\Downloads>-------------------------------------------------------------------------------->8
Version: 4.17.1 (101757)
Sha1:
Started on: 2023/03/28 22:28:51.474
Resources: C:\Users\XXXXXXXXXXXXXXXX\Downloads\resources
OS: Windows 10 Pro
Edition: Professional
Id: 2009
Build: 22621
BuildLabName: 22621.1.amd64fre.ni_release.220506-1250
File: C:\ProgramData\DockerDesktop\install-log-admin.txt
CommandLine: "Docker Desktop Installer.exe"  install --accept-license --backend=wsl-2 installation-dir=C:\Docker
You can send feedback, including this log file, at https://github.com/docker/for-win/issues
[2023-03-28T22:28:51.752432400Z][ManifestAndExistingInstallationLoader][I] No install path specified, looking for default installation registry key
[2023-03-28T22:28:51.762433500Z][Installer][I] No installation found
[2023-03-28T22:28:52.057134500Z][InstallWorkflow][I] Cancel pending background download
[2023-03-28T22:28:52.059482300Z][BackgroundTransfer][I] Cancel current background transfer job
[2023-03-28T22:28:56.228163700Z][InstallWorkflow][I] Using package: res:DockerDesktop
[2023-03-28T22:28:56.234670500Z][InstallWorkflow][I] Downloading
[2023-03-28T22:28:57.346345100Z][InstallWorkflow][I] Extracting manifest
[2023-03-28T22:29:13.314203600Z][Installer][W] Failed to track the installer started event
[2023-03-28T22:29:13.317203500Z][InstallWorkflow][I] Manifest found: version=101757, displayVersion=4.17.1, channelUrl=https://desktop.docker.com/win/main/amd64/appcast.xml
[2023-03-28T22:29:13.317203500Z][InstallWorkflow][I] Checking prerequisites
[2023-03-28T22:29:13.593427700Z][InstallWorkflow][I] Prompting for optional features
[2023-03-28T22:30:04.783492700Z][InstallWorkflow][I] Selected backend mode: wsl-2
[2023-03-28T22:30:04.784493100Z][InstallWorkflow][I] Unpacking artifacts
[2023-03-28T22:31:38.423548700Z][InstallWorkflow][I] Deploying component CommunityInstaller.CreateGroupAction
[2023-03-28T22:31:54.398667200Z][InstallWorkflow][I] Deploying component CommunityInstaller.AddToGroupAction
[2023-03-28T22:32:05.759380500Z][InstallWorkflow][I] Deploying component CommunityInstaller.EnableFeaturesAction
[2023-03-28T22:32:05.775380000Z][InstallWorkflow-EnableFeaturesAction][I] Required features: VirtualMachinePlatform, Microsoft-Windows-Subsystem-Linux
[2023-03-28T22:32:06.276356700Z][InstallWorkflow][I] Deploying component CommunityInstaller.ServiceAction
[2023-03-28T22:32:06.277357400Z][InstallWorkflow-ServiceAction][I] Removing service
[2023-03-28T22:32:06.279357200Z][InstallWorkflow-ServiceAction][I] Creating service
[2023-03-28T22:32:07.851084300Z][InstallWorkflow][I] Deploying component CommunityInstaller.ShortcutAction
[2023-03-28T22:32:07.871091500Z][InstallWorkflow-ShortcutAction][I] Creating shortcut: C:\ProgramData\Microsoft\Windows\Start Menu\Docker Desktop.lnk/Docker Desktop
[2023-03-28T22:32:07.921605900Z][InstallWorkflow][I] Deploying component CommunityInstaller.ShortcutAction
[2023-03-28T22:32:07.923606400Z][InstallWorkflow-ShortcutAction][I] Creating shortcut: C:\Users\XXXXXXXXXXXXXXXX\Desktop\Docker Desktop.lnk/Docker Desktop
[2023-03-28T22:32:07.924605500Z][InstallWorkflow][I] Deploying component CommunityInstaller.AutoStartAction
[2023-03-28T22:32:07.925605600Z][InstallWorkflow][I] Deploying component CommunityInstaller.PathAction
[2023-03-28T22:32:08.280568700Z][InstallWorkflow][I] Deploying component CommunityInstaller.ExecAction
[2023-03-28T22:32:08.284569200Z][InstallWorkflow-ExecAction][I] Running: C:\Program Files\Docker\Docker\InstallerCli.exe -i with timeout=-1
[2023-03-28T22:32:09.800365000Z][InstallWorkflow][I] Registering product
[2023-03-28T22:32:09.810376800Z][InstallWorkflow][I] Saving C:\ProgramData\DockerDesktop\install-settings.json
[2023-03-28T22:32:09.904625900Z][InstallWorkflow][I] Installation succeeded
ThePlenkov commented 1 year ago

@kindtek may be is more relevant for #13319

ThePlenkov commented 1 year ago

@kindtek i just noticed that you used installation-dir and it should be --installation-dir =)

hhromic commented 1 year ago

Since goreleaser version 0.17.0, which uses automaxprocs to access /proc/X/mountinfo, this issue became very visible (and annoying) in WSL2 with Docker Desktop.

Is there any updates from the Docker Desktop team regarding this issue and its potential resolution?

robot-head commented 1 year ago

Is this being worked on?

ErikSchierboom commented 1 year ago

I'd be interested in that too

KoljaFrahm commented 1 year ago

Me too

asolopovas commented 1 year ago

+1

seppestas commented 1 year ago

It sounds like this could be an issue with the WSL integration feature of Docker Desktop?

I wonder if it makes sense to run the docker daemon directly in a WSL distro iof using Docker Desktop...

ThePlenkov commented 1 year ago

I'm just curious will use of \040 instead of space work in this case?

gauravmm commented 1 year ago

I briefly looked into this, and the suggestion by @seppestas works: installing docker in WSL directly works, but it prevents GPU integration from working.

To get this to work with the latest (June 2023) version of Docker Desktop is simple. In an elevated (Administrator) PowerShell, run the command:

Start-Process "Docker Desktop Installer.exe" -Verb RunAs -Wait -ArgumentList "install --installation-dir=C:\Docker\"

This is essentially what @kindtek did, but in PowerShell.

AlexisHW commented 1 year ago

The following solves the issue " will retry in 3 mins: incorrect number of tail fields, expected 3 but found 4" on Windows (caused by Docker Desktop actually):

  1. Stop Docker Desktop
  2. Restart wsl (wsl --shutdown)
  3. Run "snap refresh" or whatever needed snap command (in my case it was snap remove).
  4. Restart Docker Desktop
sidevesh commented 1 year ago

How is this still broken and still an issue ?

edyu commented 1 year ago

The following solves the issue " will retry in 3 mins: incorrect number of tail fields, expected 3 but found 4" on Windows (caused by Docker Desktop actually):

  1. Stop Docker Desktop
  2. Restart wsl (wsl --shutdown)
  3. Run "snap refresh" or whatever needed snap command (in my case it was snap remove).
  4. Restart Docker Desktop

doesn't fix it for me unfortunately.

edyu commented 1 year ago
2023/10/23 15:29:22.929400 system_key.go:129: cannot determine nfs usage in generateSystemKey: cannot parse mountinfo: incorrect number of tail fields, expected 3 but found 4
2023/10/23 15:29:22.938660 cmd_run.go:1046: WARNING: cannot create user data directory: cannot determine SELinux status: failed to obtain SELinux mount path: incorrect number of tail fields, expected 3 but found 4
edyu commented 1 year ago

Still having problem in Docker version 24.0.6, build ed223bc

ThePlenkov commented 1 year ago

2023/10/23 15:29:22.929400 system_key.go:129: cannot determine nfs usage in generateSystemKey: cannot parse mountinfo: incorrect number of tail fields, expected 3 but found 4

2023/10/23 15:29:22.938660 cmd_run.go:1046: WARNING: cannot create user data directory: cannot determine SELinux status: failed to obtain SELinux mount path: incorrect number of tail fields, expected 3 but found 4

Just reinstall Docker to a path like c:\docker or anything else without a space in the name and you will forget about this issue forever. So far it doesn't seem that Docker team is working on solving this issue

gpasq commented 11 months ago

Any update on this? Still bites me in November.

phamnhuvu-dev commented 11 months ago

2023/10/23 15:29:22.929400 system_key.go:129: cannot determine nfs usage in generateSystemKey: cannot parse mountinfo: incorrect number of tail fields, expected 3 but found 4

2023/10/23 15:29:22.938660 cmd_run.go:1046: WARNING: cannot create user data directory: cannot determine SELinux status: failed to obtain SELinux mount path: incorrect number of tail fields, expected 3 but found 4

Just reinstall Docker to a path like c:\docker or anything else without a space in the name and you will forget about this issue forever. So far it doesn't seem that Docker team is working on solving this issue

Followed his way and it has worked well Install Desktop Docker from the command line and use --installation-dir=<path> https://docs.docker.com/desktop/install/windows-install/#install-docker-desktop-on-windows

RobCannon commented 11 months ago

But we install Docker Desktop via winget and that is not an option. It should be the default.

gldraphael commented 11 months ago

But we install Docker Desktop via winget and that is not an option. It should be the default.

@RobCannon - You should be able to install with:

winget install Docker.DockerDesktop --override "install --quiet --installation-dir=C:\Docker\"

References:

cbisum commented 8 months ago

I briefly looked into this, and the suggestion by @seppestas works: installing docker in WSL directly works, but it prevents GPU integration from working.

To get this to work with the latest (June 2023) version of Docker Desktop is simple. In an elevated (Administrator) PowerShell, run the command:

Start-Process "Docker Desktop Installer.exe" -Verb RunAs -Wait -ArgumentList "install --installation-dir=C:\Docker\"

This is essentially what @kindtek did, but in PowerShell.

This solved my issues