Reputation: 51
This is probably a obvious question, but i cant find a direct answer anywhere.
I installed, docker and docker machine, no problems so far. After that, i pulled this imaged based on jupyter/datascience-notebook docker. Supposedly, the only diffences is that it has Open CV installed.
Now, this is my first time using docker. I run the jupyter notebook using this command on bash:
docker run -d -p 8888:8888 -v $(pwd)/WD:/notebook dash00/datascience-notebook-opencv
This succeed in loading the jupyter notebook, it loads packages and works for every python command i try. For example, if a define functions and try them, they work.
The problem is that when i try to load data, for example:
Import pandas as pd
data=pd.read_csv("/home/mario/WD/test.csv")
i get the following error: "OSError: File b'/home/mario/WD/train.csv' does not exist" the same happens when i try to load any kind of file using any kind of package, including images using cv2
Am i referencing the path wrong? do i have to refer to a host machine?
Upvotes: 2
Views: 1834
Reputation: 5634
The -v $(pwd)/WD:/notebook
argument is mounting the $(pwd)/WD
directory on your host to /notebook
in your container. If the directory that you issued docker run …
from is /home/mario
, then you would find /home/mario/WD/test.csv
at /notebook/test.csv
in the container.
Import pandas as pd
data=pd.read_csv("/notebook/test.csv")
You can also mount more directories from your host into the container as appropriate.
Upvotes: 1
Reputation: 264306
From your docker command, you mounted /home/mario/WD into the container as /notebook (as a host volume). Therefore inside your container, you would use:
Import pandas as pd
data=pd.read_csv("/notebook/test.csv")
Upvotes: 1