docker中安装apt-get报错

更新于 阅读 253

在Dockerfile中添加如下命令

RUN apt-get update && apt-get install -y curl && apt-get clean

报错信息:

24.81 Err:8 http://deb.debian.org/debian stretch/main amd64 Packages
24.81   404  Not Found
25.08 Ign:9 http://deb.debian.org/debian stretch-updates/main all Packages
25.37 Err:10 http://deb.debian.org/debian stretch-updates/main amd64 Packages
25.37   404  Not Found
25.38 Reading package lists...
25.39 W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file.
25.39 W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file.
25.39 W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
25.39 E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-amd64/Packages  404  Not Found
25.39 E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-amd64/Packages  404  Not Found
25.39 E: Failed to fetch http://security.debian.org/debian-security/dists/stretch/updates/main/binary-amd64/Packages  404  Not Found [IP: 151.101.194.132 80]
25.39 E: Some index files failed to download. They have been ignored, or old ones used instead.

解决方式

apt-get update命令前添加命令

RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
RUN sed -i 's|security.debian.org|archive.debian.org/|g' /etc/apt/sources.list
RUN sed -i '/stretch-updates/d' /etc/apt/sources.list
标签:dockerapt-getdebian