我在Bash中运行以下命令:
DEBIAN_FRONTEND=noninteractive apt-get update -qq \
&& apt-get install -y build-essential git libncurses5-dev openssl \
libssl-dev fop xsltproc unixodbc-dev curl
它运行,但在中间失败:
Get:96 http://security.debian.org/ jessie/updates/main linux-libc-dev amd64 3.16.7-ckt9-3~deb8u1 [991 kB]
Get:97 http://security.debian.org/ jessie/updates/main curl amd64 7.38.0-4+deb8u2 [200 kB]
Get:98 http://security.debian.org/ jessie/updates/main openjdk-7-jre amd64 7u79-2.5.5-1~deb8u1 [176 kB]
Get:99 http://http.debian.net/debian/ jessie/main libgtk2.0-0 amd64 2.24.25-3 [2301 kB]
Err http://http.debian.net/debian/ jessie/main dpkg-dev all 1.17.25
Error reading from server. Remote end closed connection [IP: 176.9.184.93 80]
Get:100 http://http.debian.net/debian/ jessie/main libatk-wrapper-java all 0.30.5-1 [30.3 kB]
Get:101 http://http.debian.net/debian/ jessie/main libatk-wrapper-java-jni amd64 0.30.5-1 [24.8 kB]
Get:102 http://http.debian.net/debian/ jessie/main libatomic1 amd64 4.9.2-10 [8992 B]
Get:103 http://http.debian.net/debian/ jessie/main libavahi-glib1 amd64 0.6.31-5 [36.4 kB]
因此整个操作失败并显示错误
E: Failed to fetch http://http.debian.net/debian/pool/main/d/dpkg/dpkg-dev_1.17.25_all.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?
我将其作为Docker构建的一部分进行运行。我的Dockerfile读取
FROM debian:jessie
RUN DEBIAN_FRONTEND=noninteractive \
apt-get update -qq \
&& apt-get install -y \
build-essential \
git \
libncurses5-dev \
openssl \
libssl-dev \
fop \
xsltproc \
unixodbc-dev \
curl
而我正在跑步 docker build -t my-base:latest .
该apt-get
命令有时会成功执行,而有时会失败而无需更改任何内容。在本地开发计算机上运行它似乎总是成功,但是在EC2计算机上运行它却经常(但并非总是!)失败。此外,apt-get update
在apt-get install
帮助之前似乎连续运行两次。不过,我对最后两句话完全不满意。
任何想法可能会发生什么?apt-get中是否可以缓存某个时间戳,然后期望它是最新的?