【问题标题】:Docker build of Ubuntu 16.04 image fails - Connection failed, returned a non-zero code: 100Ubuntu 16.04 映像的 Docker 构建失败 - 连接失败,返回非零代码:100
【发布时间】:2018-12-15 05:21:29
【问题描述】:

系统详情:

  • macOS High Sierra
  • IPv6 已禁用
  • 个人网络(无公司网络、防火墙、代理等)

以下是 Dockerfile:

FROM ubuntu:16.04

RUN apt-get update && \
apt-get install -y \
python3 python3-numpy firefox jq git-core curl python3-nose python3-pandas \
python3-pip python-wheel vim && \
pip3 install --upgrade setuptools

<Rest of the Dockerfile>

在运行命令 docker build -t ubuntu-docker . 时,我得到以下输出:

<< Long trace of output>>
<<....>>
Connection failed [IP: 91.189.88.152 80]
Get:348 http://archive.ubuntu.com/ubuntu xenial/main amd64 libsnappy1v5 amd64 1.1.3-2 [16.0 kB]
Get:349 http://archive.ubuntu.com/ubuntu xenial/universe amd64 python3-tables-lib amd64 3.2.2-2 [353 kB]
Get:350 http://archive.ubuntu.com/ubuntu xenial/universe amd64 python3-tables all 3.2.2-2 [325 kB]
Get:351 http://archive.ubuntu.com/ubuntu xenial/main amd64 python3-tk amd64 3.5.1-1 [25.1 kB]
Get:352 http://archive.ubuntu.com/ubuntu xenial/universe amd64 python3-wheel all 0.29.0-1 [48.1 kB]
Get:353 http://archive.ubuntu.com/ubuntu xenial/main amd64 rename all 0.20-4 [12.0 kB]
Get:354 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim-runtime all 2:7.4.1689-3ubuntu1.2 [5164 kB]
Get:355 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 vim amd64 2:7.4.1689-3ubuntu1.2 [1036 kB]
Get:356 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 xul-ext-ubufox all 3.4-0ubuntu0.16.04.2 [3302 B]
Get:357 http://archive.ubuntu.com/ubuntu xenial/universe amd64 python3-scipy amd64 0.17.0-1 [8327 kB]
Fetched 236 MB in 5min 36s (700 kB/s)
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/n/netbase/netbase_5.3_all.deb  Connection failed [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libe/libedit/libedit2_3.1-20150325-1ubuntu2_amd64.deb  Connection failed [IP: 91.189.88.152 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/g/gtk+3.0/libgtk-3-common_3.18.9-1ubuntu3.3_all.deb  Connection failed [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libx/libxcb/libxcb-sync1_1.11.1-1ubuntu1_amd64.deb  Connection failed [IP: 91.189.88.152 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/mesa/libgl1-mesa-dri_18.0.5-0ubuntu0~16.04.1_amd64.deb  Connection failed [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/m/mesa/libwayland-egl1-mesa_18.0.5-0ubuntu0~16.04.1_amd64.deb  Connection failed [IP: 91.189.88.149 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libx/libxrandr/libxrandr2_1.5.0-1_amd64.deb  Connection failed [IP: 91.189.88.162 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/d/dpkg/dpkg-dev_1.18.4ubuntu1.4_all.deb  Connection failed [IP: 91.189.88.149 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libg/libgphoto2/libgphoto2-port12_2.5.9-3_amd64.deb  Connection failed [IP: 91.189.88.152 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/f/fakeroot/libfakeroot_1.20.2-1ubuntu1_amd64.deb  Connection failed [IP: 91.189.88.161 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/p/python-decorator/python3-decorator_4.0.6-1_all.deb  Connection failed [IP: 91.189.88.152 80]

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/python-setuptools/python3-setuptools_20.7.0-1_all.deb  Connection failed [IP: 91.189.88.152 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get update && apt-get install -y python3 python3-numpy firefox jq git-core curl python3-nose python3-pandas python3-pip python-wheel vim && pip3 install --upgrade setuptools' returned a non-zero code: 100

在间隔几分钟后,我已多次尝试此命令。在尝试使用 --no-cache 选项进行构建后,我遇到了同样的错误。

不确定non-zero code: 100 是由于连接失败 [IP:..] 错误还是完全有其他原因。 This 解决方案也没有帮助。有什么指点吗?

【问题讨论】:

标签: macos docker dockerfile ubuntu-16.04 docker-build


【解决方案1】:

添加这个

RUN sed -i'' 's/archive\.ubuntu\.com/us\.archive\.ubuntu\.com/' /etc/apt/sources.list

【讨论】:

  • 为什么会这样?我花了一天的大部分时间寻找解决方案,而这个解决方案解决了它。
  • @LeanMan 是的,首先它不应该,但我最好的猜测是他们的内核共识,默认情况下,这个 ubunut.com 必须被列入白名单,但它不是。我花了一周的时间调试这个,我了解 docker 和 ubuntu,顺便说一句,Docker 是世纪伟大的工具。
猜你喜欢
  • 1970-01-01
  • 2017-04-11
  • 2021-11-03
  • 2016-03-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-22
  • 2019-12-02
  • 1970-01-01
相关资源
最近更新 更多