rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.92k stars 281 forks source link

WSL2: docker cp : mount ...docker.sock, flags: 0x5000: not a directory #2333

Open MrLuje opened 2 years ago

MrLuje commented 2 years ago

Actual Behavior

Some scripts using docker are failing but works using docker desktop Maybe related to docker running inside containers, not totally sure

Steps to Reproduce

Result

act -j test
[Test/test] πŸš€  Start image=ghcr.io/catthehacker/ubuntu:act-20.04
[Test/test]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-20.04 platform= username= forcePull=false
[Test/test]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-20.04 platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Test/test]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-20.04 platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Test/test]   🐳  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[Test/test]   🐳  docker cp src=/home/vince/src/test/rancher-desktop/. dst=/home/vince/src/test/rancher-desktop
[Test/test]   🐳  docker exec cmd=[mkdir -p /home/vince/src/test/rancher-desktop] user= workdir=
Error: Error response from daemon: mount /mnt/wsl/rancher-desktop/run/docker-mounts/cc98e6cc-3efe-45f6-aad8-0546666338ca:/var/lib/docker/overlay2/c49fd010d5342f9f79db9bbfd76cd50f9950839c522dc97d0077a634405e3f40/merged/run/docker.sock, flags: 0x5000: not a directory

Expected Behavior

act -j test
[Test/test] πŸš€  Start image=ghcr.io/catthehacker/ubuntu:act-20.04
[Test/test]   🐳  docker pull image=ghcr.io/catthehacker/ubuntu:act-20.04 platform= username= forcePull=false
[Test/test]   🐳  docker create image=ghcr.io/catthehacker/ubuntu:act-20.04 platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Test/test]   🐳  docker run image=ghcr.io/catthehacker/ubuntu:act-20.04 platform= entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Test/test]   🐳  docker exec cmd=[mkdir -m 0777 -p /var/run/act] user=root workdir=
[Test/test]   🐳  docker cp src=/home/vince/src/test/rancher-desktop/. dst=/home/vince/src/test/rancher-desktop
[Test/test]   🐳  docker exec cmd=[mkdir -p /home/vince/src/test/rancher-desktop] user= workdir=
[Test/test] ⭐  Run actions/checkout@v3
[Test/test]   βœ…  Success - actions/checkout@v3
[Test/test] ⭐  Run actions/setup-node@v3
[Test/test]   ☁  git clone 'https://github.com/actions/setup-node' # ref=v3
...

Additional Information

Trying to build the repository https://github.com/rancher/cis-operator also doesn't work :

$> make
...
Sending build context to Docker daemon  40.26MB
Step 1/4 : FROM registry.suse.com/suse/sle15:15.3
 ---> d2fc302527bc
Step 2/4 : COPY pkg/ pkg/
 ---> Using cache
 ---> 447280743eee
Step 3/4 : COPY bin/cis-operator /usr/bin/
 ---> Using cache
 ---> 549fd4884f60
Step 4/4 : CMD ["cis-operator"]
 ---> Using cache
 ---> e3cd827bc40c
Successfully built e3cd827bc40c
Successfully tagged rancher/cis-operator:399c961-amd64
Built rancher/cis-operator:399c961-amd64
INFO[0047] docker cp /go/src/github.com/rancher/cis-operator/bin . 
Error response from daemon: mount /mnt/wsl/rancher-desktop/run/docker-mounts/76f001ac-e153-4420-afff-4f9e1c97de47:/var/lib/docker/overlay2/a2eee47352fdb11d98a498e2350af8ba5d109e593cc3883f1696d575db9d059a/merged/run/docker.sock, flags: 0x5000: not a directory
INFO[0047] docker cp /go/src/github.com/rancher/cis-operator/dist . 
Error response from daemon: mount /mnt/wsl/rancher-desktop/run/docker-mounts/76f001ac-e153-4420-afff-4f9e1c97de47:/var/lib/docker/overlay2/a2eee47352fdb11d98a498e2350af8ba5d109e593cc3883f1696d575db9d059a/merged/run/docker.sock, flags: 0x5000: not a directory

Both examples are working with Docker Desktop but are failing with Rancher Desktop

Rancher Desktop Version

1.3.0

Rancher Desktop K8s Version

1.22.7

Which container runtime are you using?

moby (docker cli)

What operating system are you using?

Windows

Operating System / Build Version

Windows 11 21H2 + WSL2 Ubuntu20.04

What CPU architecture are you using?

x64

Linux only: what package format did you use to install Rancher Desktop?

No response

Windows User Only

No response

adamkpickering commented 2 years ago

Thanks for the bug report! I was able to reproduce this on Windows 10 Pro 10.0.19044 Build 19044, both on RD 1.3.0 and on a dev build off of 4d379284. This is something that should be working. We'll try to get to it when we have a chance, though PRs are always welcome :)

kwuite commented 1 year ago

Anyone able to fix this issue? Experiencing the same issue with

bagel-dawg commented 1 year ago

I, too, am running into this, very similar specs to @kwuite.

MrLuje commented 1 year ago

I'm now also having this issue while using VSCode devcontainers feature

failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error mounting \"/mnt/wsl/rancher-desktop/run/docker-mounts/9d4b57e3-7f96-4f1e-9d21-a013a512186d\" to rootfs at \"/tmp/vscode-wayland-9658b5aa-bb1b-4ac5-abee-4e15ad8f8d05.sock\": mount /mnt/wsl/rancher-desktop/run/docker-mounts/9d4b57e3-7f96-4f1e-9d21-a013a512186d:/tmp/vscode-wayland-9658b5aa-bb1b-4ac5-abee-4e15ad8f8d05.sock (via /proc/self/fd/6), flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

Rancher Desktop 1.8.1

MrLuje commented 1 year ago

Hi @adamkpickering, just want to make sure this bug has not been forgotten If not, I can try to look at it but I'll probably need a few leads to start looking from the right place

adamkpickering commented 1 year ago

Hi @MrLuje, unfortunately the dev team is quite busy - a fix is not scheduled for inclusion in 1.11, which is scheduled for release around the end of October. After that, it's tough to say whether it will be prioritized. So if you need it fixed soon, I recommend trying to fix it yourself. I would try to give you some idea of where to start, but this isn't my area of expertise :cry:

flockoftanks commented 10 months ago

This is a pretty big deal. Not being able to use docker cp at all is pretty basic function of docker that I'm not able to use.

adamkpickering commented 10 months ago

@jandubois should this be higher priority?

Neurrone commented 9 months ago

I'm also encountering this when trying to mount a file from the host into a docker container. The error message is the same as well:

flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type 

Hope this can be fixed soon.

flockoftanks commented 9 months ago

I'm also encountering this when trying to mount a file from the host into a docker container. The error message is the same as well:

flags: 0x5000: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type 

Hope this can be fixed soon.

I don't think this is the same thing. The original issue is copying a file, not mounting. The error is different too.

flockoftanks commented 9 months ago

@jandubois should this be higher priority?

Yes.

grover572 commented 8 months ago

Does anyone know how to fix it

mrvamsidhar-ais commented 7 months ago

Any update on this?

djkormo commented 6 months ago
Error: failed to copy content to container: Error response from daemon: mount /mnt/wsl/rancher-desktop/run/docker-mounts/1de3c6b5-70d4-4bf8-9371-88db2e9fcbc6:/var/lib/docker/overlay2/4a55d9547e794bca963c07fecb07d8b8789a7dc1e348981b7fc60ec37cfe9977/merged/run/docker.sock, flags: 0x5000: not a directory

I have the same error with Rancher Desktop Version: 1.12.3