[英]Dockerfile - python: can't open file '/usr/app/client.py': [Errno 2] No such file or directory
I have the following Dockerfile... 我有以下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. 它将生成,但由于python文件而无法运行。 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
ADD应该将此文件与其他python脚本一起添加
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 例如,如果code.py在/ Downloads / Python文件夹中
Then run cd /Downloads/Python to change directory (cd) before you start. 然后在开始之前运行cd / Downloads / Python更改目录(cd)。
Then you should be able to type your command as: 然后,您应该可以将命令键入为:
$: /Downloads/Python> python code.py $:/下载/ Python> python code.py
(or similar, depending on your os) (或类似,取决于您的操作系统)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.