Reputation: 9549
My windows 10 version is 1803
I install docker fellow the link:
https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly
I try to use -v of docker like:
docker run -it -v ~/.aws:root/.aws/ ubuntu
I also try to use:
docker run -it -v $(realpath ~/.aws):/root/.aws ubuntu
But I find the volumes I want to mapping to docker system is not there.
when I do:
ls /root/.aws
there is always empty, how to mapping the data volumes on Windows Subsystem for linux?
Upvotes: 4
Views: 8791
Reputation: 97
Answer above by Serge works, but I have done away with the cmd.exe part and just enclosed the Windows style path with single quotes.
I have the same issue with Docker for Desktop running inside WSL not reading my ~/.aws folder. My .aws folder is a soft link from C:\Users\.aws folder.
This is what worked for me:
docker run -v 'C:\Users\username\.aws':/root/.aws linux_image
Upvotes: 3
Reputation: 1
This question is a bit old but I had the same issue. Below is my configuration:
The following solution is mostly useful when working on your own laptop with docker as a development environment. Shouldn't be used in production/test servers:
Below are the commands:
On Windows Host machine, create a folder on the windows machine
md %USERPROFILE%\dockerVolume
On WSL link that folder with the on the WSL user home folder
ln -s `wslpath $(cmd.exe /C "echo %USERPROFILE%")|sed -e 's/\r//g'`/dockerVolume $HOME/dockerVolume
Then run you docker container as:
docker run -it -v `cmd.exe /C "echo %USERPROFILE%"|sed 's/\r/\\\dockerVolume/g'`:/dockerVolume -w /dockerVolume --entrypoint /bin/bash <DOCKER IMAGE NAME>
Upvotes: 0
Reputation: 11014
Docker for Windows runs atop Windows itself but has no knowledge of WSL.
In WSL:
/mnt/<drive-letter>
While Docker Engine itself cannot run within WSL, you can install Docker for Windows, and operate it from within WSL using the docker
command-line tool, specifying the hostname via the -h
argument, or export to DOCKER_HOST
in your .bashrc
.
You may find some of these tutorials useful:
Upvotes: 6