简体   繁体   中英

Docker Volume Mapping: File is not getting copied from Docker linux container to local windows machine

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. 在此处输入图片说明

Please guide me on how I can resolve this ?

使用绝对路径代替 ~ 工作,即 docker run -v C:/Users/12345/Output:/app/Reports

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM