无法通过 dockerfile apt-get 更新。无法连接到 archive.ubuntu.com:80

ham*_*ees 10 apt docker 16.04

目前在 Ubuntu 16.04 LTS 上,尝试使用 Docker 拉取映像
我正在尝试安装已集成到 OSS-Fuzz 中的 AFLGo,并且我一直停留在第 2 步最长时间。shell 脚本应该从 docker 中提取所有图像以安装 AFLGo 但由于某种原因,无论我尝试什么,我都会收到此错误消息

码头工人信息:

uia65408@igl1534u:~/oss-fuzz$ docker info
Containers: 1
 Running: 0
 Paused: 0
 Stopped: 1
Images: 10
Server Version: 17.06.0-ce
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 9
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: cfb82a876ecc11b5ca0977d1733adbe58599088a
runc version: 2d41c047c83e09a6d61d464906feb2a2f3c52aa4
init version: 949e6fa
Security Options:
 apparmor
 seccomp
  Profile: default
Kernel Version: 4.13.0-37-generic
Operating System: Ubuntu 16.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.44GiB
Name: igl1534u
ID: LSHK:IO3H:DHBU:OUX3:72LJ:HOYC:GIYW:QQV2:4IYC:YO7B:UXQC:FGUA
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Https Proxy: https://localhost:3128/
Username: swonlek
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: No swap limit support
Run Code Online (Sandbox Code Playgroud)

从终端,当我运行 infra/base-images/all.sh 时:

uia65408@igl1534u:~/oss-fuzz$ infra/base-images/all.sh
+ docker build --no-cache --pull -t gcr.io/oss-fuzz-base/base-image infra/base-images/base-image
Sending build context to Docker daemon   2.56kB
Step 1/9 : FROM ubuntu:16.04
16.04: Pulling from library/ubuntu
b234f539f7a1: Pull complete 
55172d420b43: Pull complete 
5ba5bbeb6b91: Pull complete 
43ae2841ad7a: Pull complete 
f6c9c6de4190: Pull complete 
Digest: sha256:b050c1822d37a4463c01ceda24d0fc4c679b0dd3c43e742730e2884d3c582e3a
Status: Downloaded newer image for ubuntu:16.04
 ---> 5e8b97a2a082
Step 2/9 : MAINTAINER mike.aizatsky@gmail.com
 ---> Running in baafeed270aa
 ---> c82edcb20ed5
Removing intermediate container baafeed270aa
Step 3/9 : ENV DEBIAN_FRONTEND noninteractive
 ---> Running in b5c817be13c1
 ---> f6dc9252b91a
Removing intermediate container b5c817be13c1
Step 4/9 : RUN apt-get update && apt-get upgrade -y && apt-get autoremove -y
 ---> Running in 7e9338006272
Err:1 http://archive.ubuntu.com/ubuntu xenial InRelease
  Could not connect to archive.ubuntu.com:80 (91.189.88.162), connection timed out [IP: 91.189.88.162 80]
Err:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.88.162 80]
Err:3 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.88.162 80]
Err:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Could not connect to security.ubuntu.com:80 (91.189.88.149), connection timed out [IP: 91.189.88.149 80]
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Could not connect to archive.ubuntu.com:80 (91.189.88.162), connection timed out [IP: 91.189.88.162 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.88.162 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.88.162 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Could not connect to security.ubuntu.com:80 (91.189.88.149), connection timed out [IP: 91.189.88.149 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Reading package lists...
Building dependency tree...
Reading state information...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
 ---> 74d5fe84a2bb
Removing intermediate container 7e9338006272
Step 5/9 : ENV OUT /out
 ---> Running in 60124eb58434
 ---> 083e8bdaa793
Removing intermediate container 60124eb58434
Step 6/9 : ENV SRC /src
 ---> Running in 1a7e2f88b637
 ---> dceb04aa1080
Removing intermediate container 1a7e2f88b637
Step 7/9 : ENV WORK /work
 ---> Running in d2688371da7c
 ---> c399b9058b66
Removing intermediate container d2688371da7c
Step 8/9 : ENV PATH "$PATH:/out"
 ---> Running in 5a26db6cda09
 ---> 2dff83d2a778
Removing intermediate container 5a26db6cda09
Step 9/9 : RUN mkdir -p $OUT $SRC $WORK && chmod a+rwx $OUT $SRC $WORK
 ---> Running in cc724c7e78f3
 ---> 9c37de0bf9c6
Removing intermediate container cc724c7e78f3
Successfully built 9c37de0bf9c6
Successfully tagged gcr.io/oss-fuzz-base/base-image:latest
+ docker build --no-cache -t gcr.io/oss-fuzz-base/base-clang infra/base-images/base-clang
Sending build context to Docker daemon  6.656kB
Step 1/12 : FROM gcr.io/oss-fuzz-base/base-image
 ---> 9c37de0bf9c6
Step 2/12 : MAINTAINER mike.aizatsky@gmail.com
 ---> Running in db25e12ee42d
 ---> abb0fcdd608d
Removing intermediate container db25e12ee42d
Step 3/12 : RUN apt-get -y update && apt-get install -y     libc6-dev   binutils    libgcc-5-dev
 ---> Running in 9e89aeb4e170
Err:1 http://archive.ubuntu.com/ubuntu xenial InRelease
  Could not connect to archive.ubuntu.com:80 (91.189.88.161), connection timed out [IP: 91.189.88.161 80]
Err:2 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.88.161 80]
Err:3 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.88.161 80]
Err:4 http://security.ubuntu.com/ubuntu xenial-security InRelease
  Could not connect to security.ubuntu.com:80 (91.189.91.23), connection timed out [IP: 91.189.91.23 80]
Reading package lists...
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Could not connect to archive.ubuntu.com:80 (91.189.88.161), connection timed out [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.88.161 80]
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Unable to connect to archive.ubuntu.com:http: [IP: 91.189.88.161 80]
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/InRelease  Could not connect to security.ubuntu.com:80 (91.189.91.23), connection timed out [IP: 91.189.91.23 80]
W: Some index files failed to download. They have been ignored, or old ones used instead.
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libc6-dev
E: Unable to locate package binutils
E: Unable to locate package libgcc-5-dev
The command '/bin/sh -c apt-get -y update && apt-get install -y     libc6-dev   binutils    libgcc-5-dev' returned a non-zero code: 100
Run Code Online (Sandbox Code Playgroud)

基础设施/基础图像/all.sh:

docker build --no-cache --pull -t gcr.io/oss-fuzz-base/base-image $@ infra/base-images/base-image
docker build --no-cache -t gcr.io/oss-fuzz-base/base-clang $@ infra/base-images/base-clang
docker build --no-cache -t gcr.io/oss-fuzz-base/base-builder -t gcr.io/oss-fuzz/base-libfuzzer $@ infra/base-images/base-builder
docker build --no-cache -t gcr.io/oss-fuzz-base/base-runner $@ infra/base-images/base-runner
docker build --no-cache -t gcr.io/oss-fuzz-base/base-runner-debug $@ infra/base-images/base-runner-debug
Run Code Online (Sandbox Code Playgroud)

infra/base-images/base-image/dockerfile:

FROM ubuntu:16.04
MAINTAINER mike.aizatsky@gmail.com
ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get upgrade -y && apt-get autoremove -y

ENV OUT=/out
ENV SRC=/src
ENV WORK=/work
ENV PATH="$PATH:/out"

RUN mkdir -p $OUT $SRC $WORK && chmod a+rwx $OUT $SRC $WORK
Run Code Online (Sandbox Code Playgroud)

infra/base-images/base-clang/dockerfile:

FROM gcr.io/oss-fuzz-base/base-image
MAINTAINER mike.aizatsky@gmail.com

RUN apt-get -y update && apt-get install -y \
    libc6-dev \
    binutils \
    libgcc-5-dev

COPY checkout_build_install_llvm.sh /root/
# Keep all steps in the same script to decrease the number of intermediate
# layes in docker file.
RUN /root/checkout_build_install_llvm.sh
RUN rm /root/checkout_build_install_llvm.sh

# Setup the environment.
ENV CC "clang"
ENV CXX "clang++"
ENV CCC "clang++"

# FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION is described at
# http://libfuzzer.info#fuzzer-friendly-build-mode

ENV CFLAGS "-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"
ENV CXXFLAGS_EXTRA "-stdlib=libc++"
ENV CXXFLAGS "$CFLAGS $CXXFLAGS_EXTRA"
Run Code Online (Sandbox Code Playgroud)

到目前为止,它只运行到 base-clang,所以我不会在其他 dockerfile 中使用不必要的代码发送问题。
有连通性,我可以通过浏览器访问http://archive.ubuntu.com/ubuntu
我强烈怀疑网络问题,因为我在公司防火墙后面工作。那里有许多类似的错误消息,但我找不到一个完全相同的,其中有答案。或者答案适用于旧版本的 ubuntu。我已经坚持了一个星期。我是否需要申请企业无代理 wifi 设置?

ham*_*ees 8

我想我明白这个问题了。这与 docker 使用的代理有关,无法识别(我想我可能在之前解决其他问题时将其更改为无效地址)

有两种方法可以解决这个问题。在此之前,使用echo $http_proxyecho $HTTP_PROXY查找您正在使用的代理,或者如果您有另一个有效的代理,您也可以使用它。

好的第一种方法:
如果您正在运行 dockerfile,则在之前RUN apt-get update && apt-get upgrade,使用 ENV
示例设置环境:

FROM ubuntu:16.04
MAINTAINER someone@gmail.com
ENV DEBIAN_FRONTEND noninteractive
ENV http_proxy 'http://mainproxy.ucm.conti.de:8980'
ENV https_proxy 'https://mainproxy.ucm.conti.de:8980'
RUN apt-get update && apt-get upgrade -y && apt-get autoremove -y
Run Code Online (Sandbox Code Playgroud)

注意:根据Docker 文档,如果要取消设置代理,则应使用 RUN 代替,并在同一命令中取消设置,否则该值将保留在较低层。无论如何,

方法二:
可以在/etc/default/docker中定义代理

sudo nano /etc/default/docker
//under the line "If you need Docker to use an HTTP proxy..."
#export http_proxy="http://yourproxy:port"
Run Code Online (Sandbox Code Playgroud)

这对我有用!现在我有一个不同的问题,但是是的,这终于解决了!

  • 须藤 docker build --tag=arachneui --build-arg http_proxy=http://YOUR-PROXY-IP:80 。 (3认同)