0

I am trying to do volume mapping from linux container to my local windows machine.

Here are the steps:

  1. Installed latest version of Docker desktop for windows (2.4.0.0) and it's currently using WSL2 based engine.
  2. Started a container using my own image on top of alpine image. Working directory is set to '/app' in linux container.
  3. An output file (Report.html) is created under a folder (Reports) in my linux container once it is run. Able to view the file in container.
  4. I would like to save the output file to a folder named 'Output' under my user directory in local windows machine.

Ran the following command in Power Shell in Admin mode:

docker run -it -v ~/Output:/app/Reports <imagename>

Issue: Output file (Report.html) does not get copied to Output folder in local machine.

Note: I don't see the option to select drive for file sharing in Docker settings. enter image description here

Please guide me on how I can resolve this ?

newuser
  • 307
  • 3
  • 24
  • Where's Report.html location. I think it should be `./Report.html` (add dot before as your current directory). Try this `~/Output/Report.html:./Report.html` – namth Oct 22 '20 at 03:39
  • /app is my working directory in the container. Report.html is saved inside app. I tried ~/Output/Report.html:/app/Report.html. But it didn't work. Also I changed code to save Report.html in Reports folder under /app and tried: ~/Output:/app/Reports. It didn't copy either. – newuser Oct 22 '20 at 18:59
  • ./Report.html is treated as an invalid path mount specification and throws an error. – newuser Oct 22 '20 at 23:15

1 Answers1

0

Using absolute path in place of ~ worked, i.e. docker run -v C:/Users/12345/Output:/app/Reports

newuser
  • 307
  • 3
  • 24