Access file of windows machine from docker container

Rakesh K picture Rakesh K · Jul 23, 2017 · Viewed 8.9k times · Source

I have installed Docker Desktop for Windows in Windows 10 operating system. I am running a python script inside docker container which reads file from disk and add few text at the end of files. Now the requirement is to read files from Windows 10 and perform the same operation on it.

Is it possible in docker to read files from OS on top of which Docker is running?

Answer

D. Gonçalves picture D. Gonçalves · Jul 23, 2017

Of course, you can use volumes.

For example, you can run the following command:

docker run -v path/to/your/file/on/host:path/to/the/file/on/container your_image