Docker 构建在不同机器上表现不同

问题描述 投票:0回答:1

我在我的 Mac 上创建了一个 Docker 镜像。它在那里构建得很好。当我尝试在 Raspberry Pi 上构建相同的 Dockerfile 时,它不再构建。

Dockerfile 的简化版本如下所示(这仍然会产生相同的错误):

FROM python:3.6-slim

RUN pip install --upgrade pip \    
  && pip install cffi==1.11.5

错误看起来像:

Sending build context to Docker daemon  2.048kB 
Step 1/2 : FROM python:3.6-slim  ---> 61de9ac6fc45  
Step 2/2 : RUN pip install --upgrade pip && pip install cffi==1.11.5  ---> Running in 6f3799252081   
Requirement already up-to-date: pip in /usr/local/lib/python3.6/site-packages (19.0.2)   
Collecting cffi==1.11.5     
Downloading https://files.pythonhosted.org/packages/e7/a7/4cd50e57cc6f436f1cc3a7e8fa700ff9b8b4d471620629074913e3735fb2/cffi-1.11.5.tar.gz (438kB)  
    Complete output from command python setup.py egg_info:

        No working compiler found, or bogus compiler options passed to
        the compiler from Python's standard "distutils" module.  See
        the error messages above.  Likely, the problem is not related
        to CFFI but generic to the setup.py of any Python package that
        tries to compile C code.  (Hints: on OS/X 10.8, for errors about
        -mno-fused-madd see http://stackoverflow.com/questions/22313407/
        Otherwise, see https://wiki.python.org/moin/CompLangPython or
        the IRC channel #python on irc.freenode.net.)

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-w0vf1obt/cffi/ The command '/bin/sh -c pip install --upgrade pip    && pip install cffi==1.11.5' returned a non-zero code: 1

我的 Mac 上的 Docker 版本是 18.09.1,构建版本 4c52b90,在我的 Raspberry Pi 上是 18.09.0,构建版本 4d60db4。

我在两台机器上运行了

docker system prune -a
,并尝试了不同版本的Python基础镜像。

对我来说这毫无意义,而且它违背了使用 Docker 的初衷。

任何人都可以向我解释为什么 Docker 在不同的机器上会有不同的行为吗?是因为Docker版本不同造成的吗?是否可能是因为

docker system prune -a
命令无法正确清理所有内容?或者是因为 docker 在 Mac 和 Raspberry Pi 上的行为不同?

macos docker raspberry-pi dockerfile
1个回答
0
投票

从 dockerfile python 镜像中删除 -slim

© www.soinside.com 2019 - 2024. All rights reserved.