运行Dockerfile时,python:无法打开文件'setup.py':[Errno 2]没有此类文件或目录

时间:2020-10-21 10:45:40

标签: python docker flask

我正在尝试使用Dockerfile来构建映像: sudo docker build。 -f Dockerfile

我正在使用的Dockerfile:

FROM python:3.6.8-alpine
WORKDIR /usr/app

COPY . ./

RUN pip install --upgrade pip
RUN pip install --upgrade setuptools
RUN pip install -r requirements.txt


RUN export GOOGLE_APPLICATION_CREDENTIALS="/app/static/*******.json"
EXPOSE 5000
ENTRYPOINT [ "python" ]
CMD [ "app.py" ]

requirements.txt

Flask-RESTful==0.3.8
Flask==1.1.2
google-cloud-documentai==0.3.0

面临的问题:

  ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v7prcez8/grpcio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-v7prcez8/grpcio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-x0mxi6mn
         cwd: /tmp/pip-install-v7prcez8/grpcio/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-v7prcez8/grpcio/setup.py", line 212, in <module>
        if check_linker_need_libatomic():
      File "/tmp/pip-install-v7prcez8/grpcio/setup.py", line 172, in check_linker_need_libatomic
        stderr=PIPE)
      File "/usr/local/lib/python3.6/subprocess.py", line 729, in __init__
        restore_signals, start_new_session)
      File "/usr/local/lib/python3.6/subprocess.py", line 1364, in _execute_child
        raise child_exception_type(errno_num, err_msg, err_filename)
    FileNotFoundError: [Errno 2] No such file or directory: 'cc': 'cc'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 

除此之外:python setup.py egg_info给了我下面的日志

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

任何修复或线索对我都会有所帮助。

0 个答案:

没有答案