Docker. No such file or directory

Viewed 21968

I have some files which I want to move them to a docker container. But at the end docker can't find a file..

The folder with the files on local machine are at /home/katalonne/flask4

File Structure if it matters:

File Structure if it matters The Dockerfile:

#
# First Flask App Dockerfile
#
#

# Pull base image.
FROM centos:7.0.1406

# Build commands
RUN yum install -y python-setuptools mysql-connector mysql-devel gcc python-devel
RUN easy_install pip
RUN mkdir /opt/flask4
WORKDIR /opt/flask4
ADD requirements.txt /opt/flask4
RUN pip install -r requirements.txt
ADD . /opt/flask4

# Define deafult command.
CMD ["python","hello.py"]

# Expose ports.
EXPOSE 5000

So I built the image with this command :

docker build -t flask4 .

I ran the container with volume by :

docker run -d -p 5000:5000 -v /home/Katalonne/flask4:/opt/flask4 --name web flask4

And when I want to run the file on the container :

docker logs -f web

I get this error that it can not find my hello.py file :

python: can't open file 'hello.py': [Errno 2] No such file or directory

What is my fault?

P.S. : I'm a Docker and Linux partially-noob.

1 Answers
Related