docker build apt-get update找不到包
Todd

一个老项目的node-slim 打包最近遇到错误了:
RUN apt-get update && apt-get install nginx

1
2
3
4
5
6
7
$ docker build XXXX
:
E: Failed to fetch http://security.debian.org/dists/stretch/updates/main/binary-arm64/Packages 404 Not Found
E: Failed to fetch http://deb.debian.org/debian/dists/stretch/main/binary-arm64/Packages 404 Not Found
E: Failed to fetch http://deb.debian.org/debian/dists/stretch-updates/main/binary-arm64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
ERROR: executor failed running [/bin/sh -c apt-get update && apt-get install XXXXX]: exit code: 100

是因为Debian最近升级,有个stretch的包位置发生变化,需要在执行 apt-get update之前,修改掉这个地址,

1
2
3
4
RUN echo "deb http://archive.debian.org/debian/ stretch main" > /etc/apt/sources.list \
&& echo "deb http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list \
&& apt-get update \
&& apt-get install nginx

国内可以试试这个中科大的源

https://mirrors.ustc.edu.cn/help/debian.html

由 Hexo 驱动 & 主题 Keep
本站由 提供部署服务
总字数 74.6k 访客数 访问量