Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use -v volumes parameter in docker on Windows Subsystem for Linux

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?

like image 765
user504909 Avatar asked Jan 28 '23 02:01

user504909


1 Answers

Docker for Windows runs atop Windows itself but has no knowledge of WSL.

In WSL:

  • Distros can see the contents of Windows "drives" via the automatically mounted drives under /mnt/<drive-letter>
  • Windows currently cannot reach into the filesystems of installed Linux distros. We're working to remedy this in future releases ;)

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:

  • "Setting Up Docker for Windows and WSL to Work Flawlessly" by @nickjanetakis
  • "Running Docker containers on Bash on Windows" by @jayway
  • "Docker in WSL" by @wizardsoftheweb
like image 73
Rich Turner Avatar answered Jan 31 '23 09:01

Rich Turner