无法从 docker 构建中的 cdn-fastly.deb.debian.org 获取包
Failing to fetch package from cdn-fastly.deb.debian.org in docker buid
Docker 文件
FROM debian:stretch
RUN apt-get update && apt-get install -yq --no-install-recommends --force-yes --fix-missing\
curl \
git \
openjdk-8-jdk \
maven \
python2.7 python2.7-setuptools \
python3 python3-setuptools \
r-base \
r-base-core && \
rm -rf /var/lib/apt/lists/*
构建这个 Dokerfile 时,出现错误:
W: --force-yes is deprecated, use one of the options starting with --allow instead.
E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/libp/libpsl/libpsl5_0.17.0-3_amd64.deb Connection failed
E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/j/jbigkit/libjbig0_2.1-3.1+b2_amd64.deb Connection failed
E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/libx/libxmu/libxmuu1_1.1.2-2_amd64.deb Connection failed
E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/p/plexus-cli/libplexus-cli-java_1.2-5_all.deb Connection failed
E: Aborting install.
从源列表来看,我猜这与对 deb.debian.org
的不同站点访问有关:
$ docker run --rm -it debian:stretch cat /etc/apt/sources.list
# deb http://snapshot.debian.org/archive/debian/20190708T033000Z stretch main
deb http://deb.debian.org/debian stretch main
# deb http://snapshot.debian.org/archive/debian-security/20190708T033000Z stretch/updates main
deb http://security.debian.org/debian-security stretch/updates main
# deb http://snapshot.debian.org/archive/debian/20190708T033000Z stretch-updates main
deb http://deb.debian.org/debian stretch-updates main
将你的步数移至http://deb.debian.org/,你可以看到:
The server deb.debian.org does not have packages itself, but the name has SRV records in DNS that let apt in stretch and later find places.
所以我想,有时它会将您重定向到一个镜像,由于您的本地网络限制,该镜像可能不太适合您。因此,建议大家直接用合适的sources.list
替换图片中原来的那个,所有可用的见all the Debian mirrors,你可以选择你所在国家的
我使用了@atline 的回答中的 debian mirrors,它对我有用。
只想添加一个示例。对于印度,我在 Dockerfile
中添加了以下步骤
RUN echo \
'deb http://mirror.cse.iitk.ac.in/debian/ stretch main\n \
deb http://security.debian.org/debian-security stretch/updates main\n \
deb http://mirror.cse.iitk.ac.in/debian/ stretch-updates main\n' \
> /etc/apt/sources.list
Docker 文件
FROM debian:stretch
RUN apt-get update && apt-get install -yq --no-install-recommends --force-yes --fix-missing\
curl \
git \
openjdk-8-jdk \
maven \
python2.7 python2.7-setuptools \
python3 python3-setuptools \
r-base \
r-base-core && \
rm -rf /var/lib/apt/lists/*
构建这个 Dokerfile 时,出现错误:
W: --force-yes is deprecated, use one of the options starting with --allow instead. E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/libp/libpsl/libpsl5_0.17.0-3_amd64.deb Connection failed E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/j/jbigkit/libjbig0_2.1-3.1+b2_amd64.deb Connection failed E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/libx/libxmu/libxmuu1_1.1.2-2_amd64.deb Connection failed E: Failed to fetch http://cdn-fastly.deb.debian.org/debian/pool/main/p/plexus-cli/libplexus-cli-java_1.2-5_all.deb Connection failed E: Aborting install.
从源列表来看,我猜这与对 deb.debian.org
的不同站点访问有关:
$ docker run --rm -it debian:stretch cat /etc/apt/sources.list
# deb http://snapshot.debian.org/archive/debian/20190708T033000Z stretch main
deb http://deb.debian.org/debian stretch main
# deb http://snapshot.debian.org/archive/debian-security/20190708T033000Z stretch/updates main
deb http://security.debian.org/debian-security stretch/updates main
# deb http://snapshot.debian.org/archive/debian/20190708T033000Z stretch-updates main
deb http://deb.debian.org/debian stretch-updates main
将你的步数移至http://deb.debian.org/,你可以看到:
The server deb.debian.org does not have packages itself, but the name has SRV records in DNS that let apt in stretch and later find places.
所以我想,有时它会将您重定向到一个镜像,由于您的本地网络限制,该镜像可能不太适合您。因此,建议大家直接用合适的sources.list
替换图片中原来的那个,所有可用的见all the Debian mirrors,你可以选择你所在国家的
我使用了@atline 的回答中的 debian mirrors,它对我有用。
只想添加一个示例。对于印度,我在 Dockerfile
中添加了以下步骤RUN echo \
'deb http://mirror.cse.iitk.ac.in/debian/ stretch main\n \
deb http://security.debian.org/debian-security stretch/updates main\n \
deb http://mirror.cse.iitk.ac.in/debian/ stretch-updates main\n' \
> /etc/apt/sources.list