Docker Community Forums

Share and learn in the Docker community.

How to access CSV file (located in pc hdd) from a docker container with python pandas?

I want to implement a Machine Learning algorithm which can operate on homomorphic data using PySEAL library. PySEAL library is released as a docker container with an ‘examples.py’ file which shows some homomorphic encryption example. I want to edit the ‘examples.py’ file to implement the ML algorithm. I trying to import a CSV file in this way -

dataset = pd.read_csv ('Dataset.csv')

I have imported pandas library successfully. I have tried many approaches to import the CSV file but failed. I have tried -

COPY Dataset.csv app/Dataset.csv

in the DockerImage fileand then tried to access it by -

dataset = pd.read_csv ('app/Dataset.csv')

but it still shows ‘app/Dataset.csv’ does not exist.

The dataset file is in ‘home/user/Codes/Python/PySEAL’ path. So I tried this command -

docker run -v home/user/Codes/Python/PySEAL:app my-python-container

But it gives following error -

"Error response from daemon: invalid volume specification: 'home/user/Codes/Python/PySEAL:app': invalid mount config for type "volume": invalid mount path: 'app' mount path must be absolute." 

I am really new to Docker. So I think I am doing some silly mistake. How can I import the ‘Dataset.csv’ file now?