Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Servers, nginx and Docker

apt-get returns 404 Not Found while building an old Debian-based image

Error404 Not Found while running apt-get update on a jessie image

Short answer

Debian Jessie reached end of life in 2018 and its packages now live only on archive.debian.org. An old base image such as Node 8 on Jessie still points at the normal mirrors, so apt gets 404. The proper fix is a supported base image; the stopgap is to point apt at the archive.

  • Applies to Docker Engine 28, Debian 12 bookworm, Debian 13 trixie, Node.js 22, Node.js 24
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Find out which Debian release the base image is built on. If it says jessie, the repositories your image points at no longer carry it.

    docker run --rm my-base-image cat /etc/os-release
    docker run --rm my-base-image cat /etc/apt/sources.list
  2. 2Match what you see, then jump to its fix

    1. 1os-release shows jessie (Debian 8) and the 404 URLs contain /dists/jessieThe base image is an end-of-life release that the main mirrors droppedFix
    2. 2You must keep the old image for now, and the 404 lines show deb.debian.org or security.debian.orgYou cannot upgrade yet: apt must point at the Debian archiveFix
    3. 3apt reports that the Release file for the jessie archive has expiredapt rejects the archive's Release file as expiredFix

What does the error look like?

  • 404 Not Found while running apt-get update on a jessie image
  • E: Failed to fetch ... dists/jessie ... 404 Not Found

Cause 1 of 3

The base image is an end-of-life release that the main mirrors dropped

1Check

Debian Jessie reached end of life on 2018-06-17 and, like stretch and buster, is kept only in the archive. Node.js 8 is also end of life, so the old node:8-jessie tag is not a base to keep.

grep FROM Dockerfile

2Fix

Move to a supported base image and a supported Node.js line, then fix whatever your app needs to run there.

# Dockerfile
FROM node:24

3Verify

The build runs apt-get without any 404.

docker build --no-cache -t my-app .

Confirmed by debian.org

Did this fix it?

Cause 2 of 3

You cannot upgrade yet: apt must point at the Debian archive

1Check

Old releases are available from archive.debian.org under dists/jessie. The sources.list in the image still names the regular mirrors.

docker run --rm my-base-image cat /etc/apt/sources.list

2Fix

Replace the sources with the archive. This is a temporary bridge for a build you cannot change yet; the image gets no security updates.

RUN echo 'deb http://archive.debian.org/debian jessie main' > /etc/apt/sources.list \
 && apt-get update

3Verify

apt-get update finishes without a 404 (see the next cause if it complains about an expired Release file).

docker build --no-cache -t my-app .

Confirmed by debian.org

Did this fix it?

Cause 3 of 3

apt rejects the archive's Release file as expired

1Check

apt checks the Valid-Until date of the Release file by default, and an archived release no longer gets new Release files, so the date in the old one is in the past.

docker run --rm my-base-image apt-get update

2Fix

Turn the check off for that one source entry, which is what the apt documentation prefers over disabling it globally.

RUN echo 'deb [check-valid-until=no] http://archive.debian.org/debian jessie main' > /etc/apt/sources.list \
 && apt-get update

3Verify

apt-get update completes.

docker build --no-cache -t my-app .

Confirmed by manpages.debian.org

Did this fix it?

How do I stop it coming back?

  • Do not build on a distribution release that has reached end of life; check its dates on the Debian releases page before choosing a tag.
  • Pin the base image to a supported Node.js version, for example node:24, and name the Debian release with a tag such as bookworm or trixie when it matters.
  • Put a rebuild of the image in CI so a vanished mirror is found on a Tuesday, not during a production deploy.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.