I am trying to setup
docker container in my
Windows machine with
ubuntu ) without
docker desktop . The aim is to use Windows machine
ssh keys inside the docker container. I followed a tutorial Volume Mounting SSH Keys into a Docker Container and below is my
#!/bin/sh set -e cp -R /tmp/.ssh /root/.ssh chmod 700 /root/.ssh chmod 644 /root/.ssh/id_rsa.pub chmod 600 /root/.ssh/id_rsa exec "$@"
Now, when I try to run the container like this:
docker run -it -v /c/Users/<name>/.ssh:/tmp/.ssh:ro my_image
I always get
chmod: cannot access '/root/.ssh/id_rsa.pub': No such file or directory
I have tried different options like:
//c/Users/<name>/.ssh:/tmp/.ssh:ro //c//Users//<name>/.ssh:/tmp/.ssh:ro "/c/Users/<name>/.ssh:/tmp/.ssh:ro" '//c/Users/<name>/.ssh:/tmp/.ssh:ro' //c/Users/<name>/.ssh:/tmp//.ssh:ro
Also, when I
cd //c/Users/<name>/.ssh (within WSL2) there is no file.
But nothing seems to work for me.
Has anyone be able to mount windows folder as bind volume? Can anyone please let me know what is the issue here?
Thanks in advance
P.S: I am working with WSL2 (
WSL version: 220.127.116.11 and
Windows version: 10.0.22621.755) Please let me know if any info is missing