web-dev-qa-db-ja.com

dockerfileから更新をapt-getできません。 archive.ubuntu.com:80に接続できませんでした

現在Ubuntu 16.04 LTSで、Dockerを使用してイメージをプルしようとしています
私は OSS-Fuzzに統合されていたAFLGo をインストールしようとしていますが、ステップ2で長い間スタックしています。シェルスクリプトは、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

ターミナルから、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 [email protected]
 ---> 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 [email protected]
 ---> 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

infra/base-images/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

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

FROM ubuntu:16.04
MAINTAINER [email protected]
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

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

FROM gcr.io/oss-fuzz-base/base-image
MAINTAINER [email protected]

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"

これまでのところ、base-clangまでしか実行されないため、他のdockerfilesから不要なコードを送信して質問を送信することはありません。
接続性があり、ブラウザから http://archive.ubuntu.com/ubunt にアクセスできます。
企業のファイアウォールの背後で働いているため、ネットワークの問題を強く疑っています。似たようなエラーメッセージがたくさんありますが、まったく同じものがあり、答えが見つかりません。または、答えは古いバージョンのubuntuに適用されます。私は一週間これにこだわっています。企業プロキシレスWiFiのセットアップを要求する必要がありますか?

4
swonlek

私は問題を理解していると思います。これは、ドッカーが使用していたプロキシと関係があり、認識されていませんでした(以前の他の問題のトラブルシューティング中に無効なアドレスに変更した可能性があります)

これを行うには2つの方法があります。その前に、echo $http_proxyまたはecho $HTTP_PROXYを使用して、使用しているプロキシを見つけるか、動作する別のプロキシがある場合はそれも使用できます。

まず最初の方法:
dockerfileを実行している場合、RUN apt-get update && apt-get upgradeの前に、環境をENVで設定します
例:

FROM ubuntu:16.04
MAINTAINER [email protected]
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

注: Docker documentation によると、プロキシの設定を解除する場合は、代わりにRUNを使用し、同じコマンドで設定を解除する必要があります。そうしないと、値は下位層に保持されます。いずれかの方法、

2番目の方法:
プロキシは/ 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"

そしてこれは私のために働いた!今、私は別の問題を抱えていますが、はい、これは最終的に解決されました!

5
swonlek