setuptools 在 Dockerfile 中的 v3.3 上,但实际上在 v20.7.0 上



我在 Ubuntu 16.04 中运行以下命令:

git clone git@github.com:liveblog/liveblog.git
cd liveblog
docker build .

这给了我以下输出:

[.....]
Downloading/unpacking jmespath>=0.7.1,<1.0.0 (from boto3>=1.1.4,<1.5->Superdesk-Core->-r /tmp/requirements.txt (line 10))
  Downloading jmespath-0.9.3-py2.py3-none-any.whl
Downloading/unpacking cryptography>=2.1.4 (from pyOpenSSL->flask-sentinel>=0.0.4,<0.1->Superdesk-Core->-r /tmp/requirements.txt (line 10))
  Running setup.py (path:/tmp/pip_build_root/cryptography/setup.py) egg_info for package cryptography
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_root/cryptography/setup.py", line 28, in <module>
        "cryptography requires setuptools 18.5 or newer, please upgrade to a "
    RuntimeError: cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
  File "<string>", line 17, in <module>
  File "/tmp/pip_build_root/cryptography/setup.py", line 28, in <module>
    "cryptography requires setuptools 18.5 or newer, please upgrade to a "
RuntimeError: cryptography requires setuptools 18.5 or newer, please upgrade to a newer version of setuptools
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/cryptography
Storing debug log for failure in /root/.pip/pip.log
The command '/bin/sh -c cd /tmp && pip3 install -U -r /tmp/requirements.txt' returned a non-zero code: 1

通过 pip3 listpip list 检查已安装的安装工具版本返回:

[...]
setuptools (20.7.0)
[...]

我在RUN cd /tmp && pip3 install -U -r /tmp/requirements.txt之前将以下行添加到Dockerfile中:

RUN pip3 list

然后当我运行 docker build . 再次得到以下输出:

Step 20/27 : RUN pip3 list
 ---> Running in 391e5e5e490b
chardet (2.2.1)
colorama (0.2.5)
html5lib (0.999)
lxml (3.3.3)
pip (1.5.4)
requests (2.2.1)
setuptools (3.3)
six (1.5.2)
urllib3 (1.7.1)

为什么安装程序工具现在处于v3.3状态,我如何能够保存此行为?

我假设您一定一直在检查主机上的设置工具,即(20.7.0(,
但是它应该在Docker-Image中升级。(正如您所说,在您的 docker 映像中是:3.3。

尝试用这个说明替换你的说明,或者可能是更合适的任何说明。

#> RUN cd /tmp && pip3 install -U setuptools && pip3 list && pip3 install -U -r /tmp/requirements.txt

这将解决与安装工具版本相关的当前问题。

最新更新