1

I am on Windows, using docker in PyCharm to resolve dependency issues in my project. Since I am new to docker, I'm not sure if I'll still be able to read files that that are on my PC.

For example, print(__file__) results in /opt/project/version-1.py and im not sure where this is located. The files I would like to read reside in C:\datasets\kitti\train\

This is what I typed to run the docker image

docker run -it -p 8888:8888 -p 6006:6006 -v C:/test:/root/shared floydhub/dl-docker:cpu bash

Ive been trying to look for the folder /root/shared but I cant find it. There is only root :( This is so stressful

enter image description here

1 Answer 1

2

You can mount one or more local directories inside your Docker container. This way you can give PyCharm access to your source files.

This is straightforward on Linux using the -v <host-directory>:<container-path> option.

On Windows it's a bit more complicated. See this tutorial: docker-on-windows-mounting-host-directories

The gist of it is that you have to first share a drive in the settings of Docker and then you can mount it the same way as on Linux. For instance, if you have shared drive D:, you can mount directory D:\data on it like this:

D:\>docker run -v d:/data:/data alpine ls /data

This will start the alpine container and execute the ls command to show the content of the shared directory.

2
  • Hi I followed your advice but I still can't find the shared folder. I have edited my question above to include my last step.
    – Kong
    Commented May 30, 2017 at 14:45
  • Did you follow the instructions in the link I added? The main thing there is that you have to share your C: drive with Docker before your docker containers can access it. I don't have a Windows box - only Linux machines, so I can't try it myself.
    – NZD
    Commented May 31, 2017 at 5:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .