简体   繁体   中英

Dockerfile - python: can't open file '/usr/app/client.py': [Errno 2] No such file or directory

I have the following Dockerfile...

FROM python:2.7.15

RUN mkdir /usr/app
WORKDIR /usr/app
COPY ./app/requirements.txt .
RUN pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.2.1-cp27-none-linux_x86_64.whl && pip install -r requirements.txt

ADD app/* /

ENV PYTHONUNBUFFERED 1

CMD ["python", "/usr/app/client.py"]

Which will build but will not run because of python file. I have tried...

client.py

and

./client.py

None of this works. Am I missing something? The ADD should be adding this file along with other python scripts

Assuming that you have downloaded the coding files, make sure that your terminal is in the same directory as the file you want to open.

eg If code.py is in the folder /Downloads/Python

Then run cd /Downloads/Python to change directory (cd) before you start.

Then you should be able to type your command as:

$: /Downloads/Python> python code.py

(or similar, depending on your os)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM