【问题标题】:Docker failing to add repository UniverseDocker 未能添加存储库 Universe
【发布时间】:2021-06-26 19:58:36
【问题描述】:

我正在尝试将 universe 添加为我的 docker 映像中的存储库:

RUN add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"

RUN apt-get update

此输出出错:

Step 4/24 : RUN add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
 ---> Running in 4c924d1455ed
Removing intermediate container 4c924d1455ed
 ---> b472a493f90c
Step 5/24 : RUN apt-get update
 ---> Running in d4e292c43bad
Ign:1 http://deb.debian.org/debian stretch InRelease
Hit:2 http://security.debian.org/debian-security stretch/updates InRelease
Hit:3 http://deb.debian.org/debian stretch-updates InRelease
Hit:4 http://deb.debian.org/debian stretch Release
Ign:5 http://archive.ubuntu.com/ubuntu stretch InRelease
Ign:6 http://archive.ubuntu.com/ubuntu stretch Release
Ign:8 http://archive.ubuntu.com/ubuntu stretch/universe all Packages
Ign:9 http://archive.ubuntu.com/ubuntu stretch/universe amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu stretch/universe all Packages
Ign:9 http://archive.ubuntu.com/ubuntu stretch/universe amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu stretch/universe all Packages
Ign:9 http://archive.ubuntu.com/ubuntu stretch/universe amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu stretch/universe all Packages
Ign:9 http://archive.ubuntu.com/ubuntu stretch/universe amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu stretch/universe all Packages
Ign:9 http://archive.ubuntu.com/ubuntu stretch/universe amd64 Packages
Ign:8 http://archive.ubuntu.com/ubuntu stretch/universe all Packages
Err:9 http://archive.ubuntu.com/ubuntu stretch/universe amd64 Packages
  404  Not Found [IP: 91.189.88.142 80]
Reading package lists...
W: The repository 'http://archive.ubuntu.com/ubuntu stretch Release' does not have a Release file.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/stretch/universe/binary-amd64/Packages  404  Not Found [IP: 91.189.88.142 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.
ERROR: Service 'api' failed to build: The command '/bin/sh -c apt-get update' returned a non-zero code: 100

我的 Docker 文件使用 FROM python:2.7-slim 作为基础。

我做错了什么?


cat /etc/os-release的结果:

PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

【问题讨论】:

  • cat /etc/os-release 的输出是什么?
  • 抱歉,如果构建失败,我该怎么办?是否有可以打印的 RUN 命令?
  • 是的,在apt update之前添加一个RUN语句
  • @TarunLalwani 我用结果更新了我的帖子
  • 该基础镜像是一个 Debian 镜像,而您正试图将其视为一个 ubuntu 镜像。 unix.stackexchange.com/questions/113590/…

标签: linux docker ubuntu debian debian-stretch


【解决方案1】:

由于您使用debian 作为基本操作系统映像,因此您无法在 cmets 中添加Tarun Lalwani 中提到的ubuntu 的存储库。

【讨论】: