I hope I can explain my question as clear as possible. I created a Docker image including a python script, in this script the user is asked to give the path and name of the file one wishes to manipulate.
This is my Dockerfile:
FROM python:2.7.16
ADD my_script.py /
RUN pip install Pillow
RUN pip install numpy ==1.16.2
CMD [ "python", "./my_script.py" ]
Since one cannot access files in the host system from the container, I figured it is best to create a volume to share files between the host and the container and I saved some files to try my script in the 'host-data' folder, so I did:
docker run -d -P --name script-container -v ~/host-data/:container-data my_image
It works until one gives the path and name of the file and I keep getting this error message
Traceback (most recent call last):
File "./my_script.py", line 14, in <module>
image = Image.open("path+name")
File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 2766, in open
Path: File name: fp = builtins.open(filename, "rb")
IOError: [Errno 2] No such file or directory: 'path+name'
I am relatively new to Docker so I'd really appreciate some help.
This is the portion of the code where the error is occurring.
from __future__ import division
from PIL import Image
import numpy as np
path = str(raw_input("path to the file "))
name = str(raw_input("name of the file "))
image = Image.open(path + nombre)