It would seem that apt-get is having issues connecting with the repository servers. I suppose it is likely compatibility issues, as mentioned here, however the proposed solution of apt-get clean
does not work for me. Also I am surprised, if this is the case, that there are not more people having my issue.
MWE
Dockerfile
FROM debian:jessie RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends \ git
$ docker build .
docker build .
Sending build context to Docker daemon 2.048 kB
Step 0 : FROM debian:jessie
---> 4a5e6db8c069
Step 1 : RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends git
---> Running in 43b93e93feab
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
... some omitted ...
Get:6 http://httpredir.debian.org jessie-updates/main amd64 Packages [3614 B]
Fetched 9552 kB in 7s (1346 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
... some omitted ...
0 upgraded, 26 newly installed, 0 to remove and 0 not upgraded.
Need to get 13.2 MB of archives.
After this operation, 64.0 MB of additional disk space will be used.
Get:1 http://security.debian.org/ jessie/updates/main libgnutls-deb0-28 amd64 3.3.8-6+deb8u2 [694 kB]
... some omitted ...
Get:5 http://httpredir.debian.org/debian/ jessie/main libnettle4 amd64 2.7.1-5 [176 kB]
Err http://httpredir.debian.org/debian/ jessie/main libffi6 amd64 3.1-2+b2
Error reading from server. Remote end closed connection [IP: 176.9.184.93 80]
... some omitted ...
Get:25 http://httpredir.debian.org/debian/ jessie/main git amd64 1:2.1.4-2.1 [3624 kB]
Fetched 13.2 MB in 10s (1307 kB/s)
E: Failed to fetch http://httpredir.debian.org/debian/pool/main/libf/libffi/libffi6_3.1-2+b2_amd64.deb Error reading from server. Remote end closed connection [IP: 176.9.184.93 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
The command '/bin/sh -c apt-get clean && apt-get update && apt-get install -y --no-install-recommends git' returned a non-zero code: 100
Please note that I also posted here with a different issue. I believe it to be unrelated, but it may well actually be.
For whoever is having an issue with this, this is my attempt to "fix" the issue by swapping out
httpredir
with a single working domain whenever the Dockerfile is being built:What this command does is:
http://httpredir.debian.org/demo/debian/
from the building machine to get the headers from debian demo page (-s
is silent, don't output.-D
is to dump headers)Link
header fragment. This contains the best route as recommended by httpredir.sed -e ...
is to extract out the domain name of the link in step 2.httpredir.debian.org
found in/etc/apt/sources.list
.This is not a fix, but rather a simple hack to (greatly) reduce the chances of failed build. And... pardon me if it looks weird, as it's my virgin sed & piping attempt.
Edit
On a side note, if the domain that it picks simply too slow or not responding as it should, you may want to do it manually by
Visit http://httpredir.debian.org/demo.html, and you should see a link there like
http://......./debian/
. For example, at the point of writing, I sawhttp://mirrors.tuna.tsinghua.edu.cn/debian/
Instead of the long
RUN sed -i....
command, use this instead:Not enough reputation to comment on previous answers, so I will (confusingly) add a new answer:
For those visiting with similar issues, using the
--no-cache
flag in thedocker build
may help. Similar issues (though not this exact one) can occur if the apt-get update is old and not being recalled sue to caching.The httpredir.debian.org mirror is "magic" in that it will load-balance and geo-ip you to transparent increase performance and availability. I would therefore immediately suspect it of causing your problem, or at least be the first thing to rule out.
I would check if you could:
Still reproduce the problem;
httpredir.debian.org
will throw out "bad" mirrors from its internal lists so your issue may have been temporary.Reproduce the problem with a different, non-
httpredir.debian.org
mirror. Try something likeftp.de.debian.org
. If it then works with this mirror, do please contact thehttpredir.debian.org
maintainer and report the issue to them. They are quite responsive and open to bug reports.I added
apt-get clean
to my dockerfile before theapt-get update
line, it seems to have done the trick.I guess I have no way of knowing whether or not it was the extra command or if it was luck that fixed my build, but I took the advice from https://github.com/CGAL/cgal-testsuite-dockerfiles/issues/19