linuxdockerubuntudebiandebian-stretch

Docker failing to add repository Universe


I'm trying to add universe as a repository in my docker image:

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

RUN apt-get update

it errors with this output:

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

My Docker file uses FROM python:2.7-slim as a base.

What am I doing wrong?


Results of 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/"

Solution

  • Since you're using debian as base OS image, then you cannot add ubuntu's repository as mentioned by Tarun Lalwani in comments.