https://rancher.com/ logo
c

crooked-rocket-3338

07/18/2022, 3:32 PM
Hi guys, I was running rancher desktop using
containerd
/
nerdctl
successfully, now I switched to `moby`/`docker` and my mount (bind) are failing. (win11 / WSL2 / rancher desktop 1.4.1). I read a lot a related issues about that but cannot find a workaround does anyone have a lead for me ? To reproduce :
Copy code
docker run --mount type=bind,source=/etc/passwd,target=/etc/passwd --rm ubuntu:20.04
Returns:
Copy code
docker: Error response from daemon: 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/6b17adac-3323-46ab-933a-202faa10537a" to rootfs at "/etc/passwd": mount /mnt/wsl/rancher-desktop/run/docker-mounts/6b17adac-3323-46ab-933a-202faa10537a:/etc/passwd (via /proc/self/fd/6), flags: 0x5001: 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.
BTW test with
sudo
same error.
a

adventurous-insurance-41443

07/18/2022, 4:59 PM
Did you verify
/etc/passwd
is a file on both your laptop and in the container?
c

crooked-rocket-3338

07/18/2022, 7:08 PM
Definity existing on both sides.
s

sticky-summer-13450

07/19/2022, 8:17 AM
I have a feeling I remember reading in this Slack channel that only folders in $HOME could be mounted as volumes. Or maybe $HOME and a few other locations. I can't remember exactly...
c

crooked-rocket-3338

07/19/2022, 2:43 PM
This is really not that clear. Anyway managed my way around to run stuff a normal user in container without the need to mount
passwd
and
groups
files. Thank anyway !
s

sticky-summer-13450

07/19/2022, 2:49 PM
https://docs.rancherdesktop.io/faq/#q-does-file-sharing-work-similarly-to-docker-desktop-d[…]do-any-additional-configuration-to-mount-volumes-to-vms
Currently, the following directories are shared by default:
/Users/$USER
on macOS,
/home/$USER
on Linux, and
/tmp/rancher-desktop
on both. For Windows, all files are automatically shared via WSL2.
c

crooked-rocket-3338

07/19/2022, 2:52 PM
Nice ! Thanks.
👍 1
c

clever-analyst-53581

08/06/2022, 8:14 PM
Using a wsl2 setup as well but for some reason it mounts Paths /mnt/wsl/rancher-desktop/run/docker-mounts/ instead of natively within wsl. Is there a fix for this? Works first container run but after running it again after a restart causes same issue
p

proud-jewelry-46860

08/08/2022, 5:11 PM
It needs the funny mount because WSL2 uses containers for different distros, and that's how we can share things across. We basically have to end up bind-mounting your mount source into the shared area, and then get dockerd to bind-mount it again into the container. It sounds like there's an issue with files though (which I thought we had fixed at some point); will need to take a look again. (But it's probably the same as #2461)
c

clever-analyst-53581

08/09/2022, 9:00 AM
Cool, ill have a look and this is a way of recreating it, if it helps, by running it, stopping and re-running it which gives the error. Noticed when you try and bind things below it gets confused second time round
Copy code
- /etc/localtime:/etc/localtime:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
https://github.com/mohimali/docker/tree/master/portainer
751 Views