0

System details:

  • macOS High Sierra
  • IPv6 disabled
  • Personal network (No corporate network, firewall, proxy etc.)

Following is the 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>

On running the command docker build -t ubuntu-docker . I am getting following output:

<< 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

I have tried this command multiple times each after few minutes of interval. I am getting the same error after trying the build with --no-cache option.

Not sure if the non-zero code: 100 is a result of the connection failed [IP:..] error or it has some other reason altogether. This solution didn't help either. Any pointers?

Ravindra S
  • 6,302
  • 12
  • 70
  • 108
  • Check from the browser if you can access archive.ubuntu.com or 91.189.88.152. It should be accessible. – Tejas Sarade Jul 06 '18 at 19:23
  • 91.189.88.152 is accessible from my browser. – Ravindra S Jul 07 '18 at 12:19
  • Not sure but read through the section about `apt-get` here; I wonder if you're running into a caching issue: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run – souldeux Jul 07 '18 at 12:56
  • Use the --network host option with build, it will directly user host network interface for communication. – Tejas Sarade Jul 07 '18 at 13:57
  • Possible duplicate of [In Docker, apt-get install fails with "Failed to fetch http://archive.ubuntu.com/ ... 404 Not Found" errors. Why? How can we get past it?](https://stackoverflow.com/questions/37706635/in-docker-apt-get-install-fails-with-failed-to-fetch-http-archive-ubuntu-com) – TheExorcist Dec 19 '18 at 22:23

1 Answers1

2

Just add this

RUN sed -i'' 's/archive\.ubuntu\.com/us\.archive\.ubuntu\.com/' /etc/apt/sources.list
TheExorcist
  • 1,966
  • 1
  • 19
  • 25
  • why does this happen? I spent a good part of the day looking for a solution and this one resolved it. – LeanMan Apr 27 '21 at 19:06
  • 1
    @LeanMan Yeah, in first place it should not, but my best guess is their kernel consensus thing, in default case this ubunut.com must be whitelisted but it is not.I spent one week debugging this, I understood docker and ubuntu, btw Docker is great tool of century. – TheExorcist Apr 28 '21 at 09:15