docker - apt-get update 在以前工作的版本中失败,出现 404

标签 docker travis-ci debian-jessie

我正在运行 Travis 构建,但在构建 mysql:5.7.27 docker 镜像时失败。 Dockerfile 运行 apt-get update 然后我得到一个错误 W: Failed to fetch http://deb.debian.org/debian/dists/jessie-updates/main/binary- amd64/Packages 404 Not Found.

使用 curl 我可以看到它正在重定向,但重定向到 URL 会导致 404。有没有人看到这种行为并有补救措施?在 debian 进行更改之前,它基本上是无法修复的吗?

➜  ms git:(develop) curl --head http://deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages
HTTP/1.1 302 Found
Date: Tue, 26 Mar 2019 16:03:04 GMT
Server: Apache
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Referrer-Policy: no-referrer
X-Xss-Protection: 1
Location: http://cdn-fastly.deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages
Content-Type: text/html; charset=iso-8859-1

➜  ms git:(develop) curl --head http://cdn-fastly.deb.debian.org/debian/dists/jessie-updates/main/binary-amd64/Packages
HTTP/1.1 404 Not Found
Server: Apache
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Referrer-Policy: no-referrer
X-Xss-Protection: 1
Content-Type: text/html; charset=iso-8859-1
Via: 1.1 varnish
Content-Length: 316
Accept-Ranges: bytes
Date: Tue, 26 Mar 2019 16:03:17 GMT
Via: 1.1 varnish
Age: 45
Connection: keep-alive
X-Served-By: cache-ams21028-AMS, cache-cdg20741-CDG
X-Cache: HIT, HIT
X-Cache-Hits: 6, 2
X-Timer: S1553616198.734091,VS0,VE0

最佳答案

这是因为

as Wheezy and Jessie have been integrated into the archive.debian.org structure recently, we are now removing all of Wheezy and all non-LTS architectures of Jessie from the mirror network starting today.

(如您所见 here)

一个解决方案(根据 https://github.com/debuerreotype/docker-debian-artifacts/issues/66#issuecomment-476616579 )是添加这一行:

RUN sed -i '/jessie-updates/d' /etc/apt/sources.list  # Now archived

在使用 debian:jessie 时调用 any apt-get update 之前进入您的 Dockerfile。这将从 sources.list 中删除 jessie-updates 存储库(现在会导致 404)。

因此,虽然以下方法不起作用:

FROM debian:jessie
RUN apt-get update
CMD /bin/sh

它的工作原理是:

FROM debian:jessie
RUN sed -i '/jessie-updates/d' /etc/apt/sources.list  # Now archived
RUN apt-get update
CMD /bin/sh

关于docker - apt-get update 在以前工作的版本中失败,出现 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55361762/

相关文章:

gradle - 缓存 gradle 依赖项,Travis CI

qt - 完整和完整地卸载QT Creator

node.js - npm 全局安装链接到错误的目录

linux - 如何为 debian :jessie 构建 .net 核心应用程序

python - 在docker和psycopg2中使用Python中的unittest

docker - Nginx Reserve-Proxy https和http连接错误

r - travis 构建失败,因为缺少 devtools

docker - COPY失败:stat/var/lib/docker/tmp/docker-builderXXXXX/default.conf:没有这样的文件或目录

docker - 找出内部 OpenShift 注册表 IP 或 URL

continuous-integration - 为 travisci 提供数据库镜像