Debian httpredir镜像系统不可靠/不可用在Docker? [英] Debian httpredir mirror system unreliable/unusable in Docker?
问题描述
Debian的 httpredir.debian.org
镜像服务会导致我的Docker版本失败非常频繁,因为apt-get无法下载包或连接到服务器或类似的东西。我是唯一有这个问题的人吗?是我的问题,Debian还是Docker?有没有什么可以做的?
Debian's httpredir.debian.org
mirror service causes my Docker builds to fail very frequently because apt-get can't download a package or connect to a server or things like that. Am I the only one having this problem? Is the problem mine, Debian's, or Docker's? Is there anything I can do about it?
我有几个Dockerfiles建在 debian:jessie
,Debian默认情况下使用 httpredir.debian.org
服务在使用apt-get时找到最好的镜像,几个月前,httpredir在尝试构建图像时给我不断的悲伤。当在Docker文件中运行时,使用httpredir的apt-get几乎总是在一两个包中混乱,整个构建将失败。错误通常看起来像镜子已经过时或者以某种方式腐败。我最终在所有Dockerfiles中停止使用httpredir:添加以下行:
I have several Dockerfiles built on debian:jessie
, and Debian by default uses the httpredir.debian.org
service to find the best mirror when using apt-get, etc. Several months ago, httpredir was giving me continual grief when trying to build images. When run inside a Dockerfile, apt-get using httpredir would almost always mess up on a package or two, and the whole build would fail. The error usually looked like a mirror was outdated or corrupt in some way. I eventually stopped using httpredir in all my Dockerfiles by adding the following lines:
# don't use httpredir.debian.org mirror as it's very unreliable
RUN echo deb http://ftp.us.debian.org/debian jessie main > /etc/apt/sources.list
今天回到尝试 httpredir。 debian.org
再次因为 ftp.us.debian.org
已经过时了,我需要一个软件包,而且Docker的失败Hub:
Today went back to trying httpredir.debian.org
again because ftp.us.debian.org
is out of date for a package I need, and sure enough it's failing on the Docker Hub:
Failed to fetch http://httpredir.debian.org/debian/pool/main/n/node-retry/node-retry_0.6.0-1_all.deb Error reading from server. Remote end closed connection [IP: 128.31.0.66 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
这是我在这种情况下运行的apt-get命令,尽管我遇到了许多其他人:
Here's the apt-get command I'm running in this case, though I've encountered it with many others:
RUN apt-get update && apt-get install -y \
build-essential \
chrpath \
libssl-dev \
libxft-dev \
libfreetype6 \
libfreetype6-dev \
libfontconfig1 \
libfontconfig1-dev \
curl \
bzip2 \
nodejs \
npm \
git
感谢您提供的任何帮助。
Thanks for any help you can provide.
推荐答案
我今天刚刚遇到同样的问题,当重建一个Dockerfile时,我没有建立一段时间。
I just had the same problem today, when rebuilding a Dockerfile I had not build in a while.
在 apt-get install
之前添加此行似乎是诀窍:
Adding this line before the apt-get install
seems to do the trick:
运行apt-get clean
在这里找到想法:
- https://github.com/docker/hub-feedback/问题/ 556
- https :// github.com/docker-library/buildpack-deps/issues/40
- https://github.com/Silverlink/buildpack-deps/commit/be1f24eb136ba87b09b1dd09cc9a48707484b417
- https://github.com/docker/hub-feedback/issues/556
- https://github.com/docker-library/buildpack-deps/issues/40
- https://github.com/Silverlink/buildpack-deps/commit/be1f24eb136ba87b09b1dd09cc9a48707484b417
这篇关于Debian httpredir镜像系统不可靠/不可用在Docker?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!