I am trying to access a network drive from my docker container, but the mounted directory in the container is shown as empty.
The host docker runs on has Windows 10 Enterprise LTSC, Build 17763 (which seems to not support wsl2 yet, but we don’t want to update it. Docker version is 24.0.6 The image is continuumio/miniconda3 I have added the file share <address>/<folder>
in docker desktop under resources. I can access the network drive from the host. I can also mount C:/ and D:/ with the -v flag successfully.
my best attempt for the docker run options has been:
docker run --network=host --rm -v //<address>/<folder>:/mount -it --entrypoint /bin/bash --name my_container my_image
Also, the (empty) directory /mount seems remember when I put some test.txt in it from within the container, even when I run a new container.
some other attempts:
I have also mapped the letter X: to //<address>/<folder>: on the host, and using X: instead of //<address>/<folder>
: in the -v flag gives the message: “docker wants access to U:\C<address>/<folder>
. Do you want to share it?”. Accepting this gives the error "docker: Error response from daemon: error while creating mount source path '/host_mnt/uC/<adress>/<folder>': mkdir /host_mnt/uC: operation not permitted.
" I also dont know what’s going on there.
I also tried my laptop, which has a wsl2 docker version, and it also didn’t work there. And I also tried: apt-get update && apt-get install -y cifs-utils
mount -t cifs //<address>/<folder> /mount -o username=<user>,password=<password>,vers=3.0
but got: "Unable to apply new capability set. " which doesn’t tell me anything of course.
And: docker volume create --driver local --opt type=cifs --opt device=//<adress>/<folder> --opt o=addr=shareddrivename,username=...,password=...,vers=3.0 myvol
docker run --network=host --rm -v myvol:/mnt/mount2 -it --entrypoint /bin/bash --name thor2 my_image
this gave the error: docker: Error response from daemon: error while mounting volume '/var/lib/docker/volumes/myvol/_data': error resolving passed in network volume address: lookup shareddrivename on 192.168.x.x:53: read udp 192.168.x.y:56258->192.168.x.x:53: i/o timeout.
I have basically just been trying 100 different things, but I dont know how to get feedback on why the mounting doesn’t work. Any ideas, specifically on how to systematically approach this?
I tried mounting a net drive via docker run --network=host --rm -v //<address>/<folder>:/mount -it --entrypoint /bin/bash --name my_container my_image
expected the files of the drive to show up directory was empty