今天想在容器中安装一个pigz插件,于是就在dockerfile中使用RUN命令RUN apt-get install -y pigz结果构建镜像的时候报错Unable to locate package pigz
意思也就是说下载不下来这个包,猜想可能是没有更新软件源,于是命令改成RUN apt-get update && apt-get install -y pigz结果在构建的时候又报了一大堆错
Err http://deb.debian.org jessie-backports/main amd64 Packages
Err http://deb.debian.org jessie-backports/main amd64 Packages
Err http://deb.debian.org jessie-backports/main amd64 Packages
Err http://deb.debian.org jessie-backports/main amd64 Packages
Err http://deb.debian.org jessie-backports/main amd64 Packages
404 Not Found
Fetched 10.1 MB in 6min 28s (26.0 kB/s)
W: There is no public key available for the following key IDs:
AA8E81B4331F7F50
W: Failed to fetch http://deb.debian.org/debian/dists/jessie-backports/main/binary-amd64/Packages 404 Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.
瞬间头大了,感觉我没得搞了,搞木到了
然鹅搞木到并不能解决问题啊,我等苦役没有讨价还价的权利,只能继续搞,又转身荡漾在网络的海洋里,茫然不知所措像个无家可归的浪子
在海洋里发现很多人说这个是国外源的问题,要换成国内的源(国内源阿里,网易,中科大等),本畜一一试过,皆不可取解决不了我的问题
然而有问题就可能不止我一个人遇到,也肯定有人解决
经过长时间的艰苦漂泊,终于看到了一丝曙光,有人和我遇到了同样的问题并且他在海里漂过之后解决了,于是我用他的方法(通过删除行的方式)试了一下
于是问题解决了,没错解决了,所谓苦海无边,岸就在那一刹间。
下面是在dockerfile中添加的代码:
RUN echo "deb [check-valid-until=no] http://cdn-fastly.deb.debian.org/debian jessie main" > /etc/apt/sources.list.d/jessie.list
RUN echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main" > /etc/apt/sources.list.d/jessie-backports.list
RUN sed -i '/deb http:\/\/deb.debian.org\/debian jessie-updates main/d' /etc/apt/sources.list
RUN apt-get -o Acquire::Check-Valid-Until=false update
RUN apt-get install -y pigz
参考https://blog.csdn.net/O_Oomg/article/details/99683628