48

Dockerfile:

FROM maven:3.5.2-jdk-8

RUN apt-get update &&
apt-get install -y python-dev python-pip RUN pip install awscli --upgrade

Build Logs:

Preparing build context archive…
[==================================================>]3380/3380 files
Done

Sending build context to Docker daemon… [==================================================>] 23.19MB Done

Step 1/17 : FROM maven:3.5.2-jdk-8 ---> d07bef19f01a Step 2/17 : RUN apt-get update && apt-get install -y python-dev python-pip ---> Running in ebed1b8ce61e Ign:1 http://security.debian.org stretch/updates InRelease Ign:2 http://deb.debian.org/debian stretch InRelease Ign:3 http://security.debian.org stretch/updates Release Ign:4 http://deb.debian.org/debian stretch-updates InRelease Ign:5 http://deb.debian.org/debian stretch Release Ign:6 http://deb.debian.org/debian stretch-updates Release Ign:7 http://deb.debian.org/debian stretch/main arm64 Packages Ign:8 http://deb.debian.org/debian stretch/main all Packages Ign:9 http://deb.debian.org/debian stretch-updates/main arm64 Packages Ign:10 http://deb.debian.org/debian stretch-updates/main all Packages Ign:7 http://deb.debian.org/debian stretch/main arm64 Packages Ign:8 http://deb.debian.org/debian stretch/main all Packages Ign:11 http://security.debian.org stretch/updates/main arm64 Packages Ign:12 http://security.debian.org stretch/updates/main all Packages Ign:11 http://security.debian.org stretch/updates/main arm64 Packages Ign:9 http://deb.debian.org/debian stretch-updates/main arm64 Packages Ign:12 http://security.debian.org stretch/updates/main all Packages Ign:11 http://security.debian.org stretch/updates/main arm64 Packages Ign:12 http://security.debian.org stretch/updates/main all Packages Ign:11 http://security.debian.org stretch/updates/main arm64 Packages Ign:10 http://deb.debian.org/debian stretch-updates/main all Packages Ign:7 http://deb.debian.org/debian stretch/main arm64 Packages Ign:12 http://security.debian.org stretch/updates/main all Packages Ign:8 http://deb.debian.org/debian stretch/main all Packages Ign:9 http://deb.debian.org/debian stretch-updates/main arm64 Packages Ign:10 http://deb.debian.org/debian stretch-updates/main all Packages Ign:7 http://deb.debian.org/debian stretch/main arm64 Packages Ign:8 http://deb.debian.org/debian stretch/main all Packages Ign:9 http://deb.debian.org/debian stretch-updates/main arm64 Packages Ign:10 http://deb.debian.org/debian stretch-updates/main all Packages Ign:7 http://deb.debian.org/debian stretch/main arm64 Packages Ign:8 http://deb.debian.org/debian stretch/main all Packages Ign:11 http://security.debian.org stretch/updates/main arm64 Packages Ign:9 http://deb.debian.org/debian stretch-updates/main arm64 Packages Ign:12 http://security.debian.org stretch/updates/main all Packages Ign:10 http://deb.debian.org/debian stretch-updates/main all Packages Err:7 http://deb.debian.org/debian stretch/main arm64 Packages 404 Not Found Ign:8 http://deb.debian.org/debian stretch/main all Packages Err:9 http://deb.debian.org/debian stretch-updates/main arm64 Packages 404 Not Found Ign:10 http://deb.debian.org/debian stretch-updates/main all Packages Err:11 http://security.debian.org stretch/updates/main arm64 Packages 404 Not Found Ign:12 http://security.debian.org stretch/updates/main all Packages Reading package lists... W: The repository 'http://security.debian.org stretch/updates Release' does not have a Release file. W: The repository 'http://deb.debian.org/debian stretch Release' does not have a Release file. W: The repository 'http://deb.debian.org/debian stretch-updates Release' does not have a Release file. 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 response from daemon: The command '/bin/sh -c apt-get update && apt-get install -y python-dev python-pip' returned a non-zero code: 100 Failed to deploy '<unknown> Dockerfile: Dockerfile': Can't retrieve image ID from build stream

This Dockerfile used to build fine and has only recently started throwing this error

4 Answers4

71

Stretch has been moved to archive.debian.org, you need to update your repository configuration or better yet, use a newer base image.

To update your repository configuration, change deb.debian.org to archive.debian.org in lines referencing Stretch in /etc/apt/sources.list and files in /etc/apt/sources.list.d.

Stephen Kitt
  • 434,908
63

Thanks @stephen-kitt! I would expect them to update the docker images with this change :(

If it helps anyone we needed to update our docker image (python:3.7.3-slim) with the following change to bypass the error (while still being able to install basic packages):

RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list

at least the PGP key was left untouched...

  • 9
    You’re using a 4-year-old image — once a version-specific image is tagged, it’s common practice not to update it. What you should really do is switch to a newer image, e.g. 3.7.16-bullseye if you want a version-specific image, 3.7-bullseye if you want to always track the latest 3.7 image using Bullseye. – Stephen Kitt Apr 25 '23 at 11:33
  • 5
    I need more lines in my sources.list in order to apt install packages like curl:RUN echo "deb http://archive.debian.org/debian stretch main" >> /etc/apt/sources.list RUN echo "deb-src http://archive.debian.org/debian stretch main" >> /etc/apt/sources.list RUN echo "deb http://archive.debian.org/debian stretch-backports main" >> /etc/apt/sources.list RUN echo "deb http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list RUN echo "deb-src http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list – Aravind Apr 26 '23 at 14:07
  • 1
    Better yet, use https:

    RUN echo "deb https://archive.debian.org/debian stretch main" > /etc/apt/sources.list

    – Peter Dietz Apr 27 '23 at 12:47
9

Thank you @Stephen_Kitt and @Ben_Kaplan for the helpful answers!

Inspired by them, i added the following to my Dockerfile to switch to archive.debian.org:

RUN sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
RUN sed -i s/security.debian.org/archive.debian.org/g /etc/apt/sources.list
RUN sed -i s/stretch-updates/stretch/g /etc/apt/sources.list

With that, all works fine and no misleading error messages pops up.

Edit: By the comment below by Scott G, this works only if there are no other sources listet thant deb.debian.org.

Mateus
  • 3
AlexF
  • 91
  • 2
    I don't think this is correct. You want to replace the entire sources.list file like @ben-kaplan does in his answer. Otherwise, if your sources.list file has other entries it can still cause apt update to fail. This is because if you have a security.debian.org entry for the stretch/updates distribution, this should be removed. Or if you have a deb.debian.org entry with stretch-updates, this will be replaced with the sed command to incorrectly point to archive.debian.org for the stretch-updates distribution which doesn't exist. – Scott G Apr 25 '23 at 16:49
  • @Scott G: Thank you for that hint and you are completely right. The sources.list in our docker-image don't have any entries to security.debian.org, so i didn't think that this can also be a option for others. – AlexF Apr 27 '23 at 12:33
3

For a node 12 image with similar issues I also had to add the debian security to be able to install libnotify

By adding the below lines I managed to get the docker image working again.

The first line overwrites any existing content in sources.list, the rest append tot the "new" sources file.

RUN MAJOR_VERSION=$(echo $NODE_VERSION | cut -d '.' -f 1) && \
    if [ "$MAJOR_VERSION" = "12" ] ; then \
    echo "deb [trusted=yes] http://archive.debian.org/debian stretch main non-free contrib" > /etc/apt/sources.list && \
    echo 'deb-src [trusted=yes] http://archive.debian.org/debian/ stretch main non-free contrib'  >> /etc/apt/sources.list && \
    echo 'deb [trusted=yes] http://archive.debian.org/debian-security/ stretch/updates main non-free contrib'  >> /etc/apt/sources.list; \
    fi
  • 1
    This should be the top answer, IMO. It doesn't give a partial answer and then 'instruct' the obvious about an old node:12 image: it just answers the question with a complete solution – Rondo Oct 04 '23 at 03:46