All jobs

Fix "The repository 'http://deb.debian.org/debian buster Release' does not have a Release file" in a Docker build

Yes. An agent confirms the buster archive left the mirror, moves the image to a supported Debian and Python, rebuilds it and runs the tests before opening a PR.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

Debian 10, buster, left the main mirror after its long-term support ended. http://deb.debian.org/debian/dists/buster/InRelease now answers 404, and so do buster-updates and security.debian.org/debian-security/dists/buster/updates; the files live on archive.debian.org, which still answers 200 but receives no security updates. Any Dockerfile that starts from a -buster image and runs apt-get update therefore fails on its first layer, with Err: http://deb.debian.org/debian buster InRelease 404 Not Found and then E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file. Nothing in the repository changed; the build that passed last quarter fails this one.

DagsHub/fds, a command-line wrapper around git and DVC, is a small example with every part of the pattern. Its Dockerfile starts FROM python:3.7-buster, runs apt-get update && apt-get -y upgrade on line 2, adds a non-root appuser, installs requirements.txt with pip3 install --no-cache-dir, and sets ENTRYPOINT ["python", "/usr/src/app/fds/fds/cli.py"]. The python:3.7-buster tag on Docker Hub was last updated in June 2023 and Python 3.7 itself reached end of life that month, so the base image carries an interpreter nobody patches on a Debian nobody patches. requirements.txt pins five pure-Python packages from 2021, setup.py says python_requires='>=3.6', and .github/workflows/test.yml runs flake8 and pytest on Python 3.6 to 3.9.

The sandbox has no Docker, so the agent installs it first (sudo apt-get install -y docker.io, then starts dockerd) and reproduces the failure with docker build ., keeping the exact apt output. It also shows the cause without Docker: curl -sI against the buster InRelease on deb.debian.org returns 404 while the same path on archive.debian.org returns 200. That pair of facts is what rules out the quick patch of rewriting sources.list to the archive: it would build again, with a Debian that gets no fixes.

Then it moves the image rather than the mirror. It reads python_requires, the pins and the test matrix to pick the newest Python the code supports, installs the requirements on that interpreter in a clean environment to prove the 2021 pins still resolve, and changes the base to a current slim tag such as python:3.12-slim-bookworm, keeping the apt-get update && apt-get -y upgrade line, the appuser and the entrypoint as they are. Because the old full image shipped git and the slim one does not, it reads fds/services/git_service.py and dvc_service.py, which shell out to git and dvc, and adds git to the apt line so the entrypoint still works. It rebuilds, runs the unit tests under tests/ inside the new image, runs the CLI's --help through the entrypoint, and pins nothing it did not test.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Our Docker image no longer builds: apt-get update fails with E: The repository 'http://deb.debian.org/debian buster Release' does not have a Release file. Read every Dockerfile and compose file, and list each base image tag with its Debian release and Python version. Confirm the cause without guessing: request the buster InRelease file on deb.debian.org and on archive.debian.org and record both status codes. The sandbox has no Docker, so install it with apt-get and start dockerd, then build the image as it is and keep the failing apt output. Do not point sources.list at archive.debian.org; that Debian receives no security updates. Instead move each image to a supported base: read python_requires, the dependency pins and the CI matrix to choose the newest Python the project supports, install the pinned requirements on that interpreter in a clean environment to prove they still resolve, and change the FROM line to a current slim Debian tag for that Python. Compare what the old full image provided (git, build tools) with what the slim one lacks, read the code for commands it shells out to, and add only the apt packages the entrypoint needs. Keep the non-root user, the entrypoint and every other instruction unchanged. Rebuild, run the project's unit tests inside the new image, run the entrypoint with --help, and include all output. Open a pull request that lists each changed line, the image tags before and after, and what could not be verified in the sandbox.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

A pull request that changes the FROM line and one apt line of the Dockerfile, and nothing in the application code. Its description opens with the proof: the apt error from building the unchanged file, and the two curl status codes that show the archive moved. Below it is a before-and-after line for the base image, with the Debian release and Python version of each, and the clean-environment install that shows the pinned requirements resolve on the new interpreter.

A reviewer checks the apt packages added back, because that is the one place a slim base differs in a way the application notices: a CLI that shells out to git needs it installed, and the pull request names the line of code that calls it. The build log and the test output from inside the new image sit under that.

What the sandbox cannot prove is listed last. The image was built for the sandbox's architecture only, and the integration tests under tests/it need a DVC remote, so a multi-platform build and the integration suite are for the reviewer's CI before the image is pushed.

Run it on every failed image build

Create an automation on the repository's Project with the prompt above and a github trigger on check_suite.failure. A failed suite's details follow the prompt as event text, so the agent sees the apt error and the job name before it clones, and the prompt tells it to answer in one line when the failed suite is not the image build. If nothing builds the image in CI, as in the example repository, a schedule trigger with a weekly cron does the job a pipeline would have: the agent builds every Dockerfile and opens a pull request only when one fails with this error.

A registry or a host that alerts on a failed build can start the same automation through a webhook trigger, but most of them sign their own requests and cannot add the Authorization: Bearer header the trigger expects, so a handler on your server receives their webhook and forwards the body with the trigger's secret.

The use case this job follows, with its automation and trigger: Fix a bug from an alert.

Why run it on Rush?

The tempting fix is one sed on sources.list that points buster at the archive, and it works until the next audit asks why production runs a Debian with no security updates. The agent is asked to show the cause with two status codes and to move the base instead, and because every command runs in a sandbox with its output kept, the pull request carries the failing build, the status codes, the clean install on the new Python and the passing tests inside the new image, rather than a reviewer's trust that a base-image bump is harmless.

The sandbox is also where the difference between a full and a slim image shows up before production does. The old python:3.7-buster carried git; a slim tag does not, and an entrypoint that shells out to git fails on its first command. Running the entrypoint and the tests inside the rebuilt image, in the run, turns that into a one-line apt change instead of an incident.

Frequently asked questions

Can I just point sources.list at archive.debian.org?

The build will pass again, and the run shows the archive still answers 200. But buster's long-term support has ended, so that image gets no security fixes for the operating system or for Python 3.7, which reached end of life in June 2023. The request forbids this route and moves the base instead.

Which base image does the agent choose?

The newest Python the project supports, on a current slim Debian tag. It reads python_requires, the pins and the CI matrix, then proves the pinned requirements install on that interpreter before changing the FROM line, and names the tag it chose in the pull request.

Why did the entrypoint break after moving to a slim image?

Slim tags leave out tools the full image had, git among them. The agent reads the code for commands it shells out to and adds those packages on the existing apt line, which is why the pull request names the lines in git_service.py that call git.

Does the agent need Docker to do this?

The sandbox has none, so the agent installs docker.io, starts dockerd, and builds the image there. The cause is confirmed without Docker as well, by requesting the buster InRelease file on both mirrors, so the pull request stands even if the build step is skipped.

Will my pinned Python packages still install?

The agent checks before changing anything by installing requirements.txt on the new interpreter in a clean environment and keeps that output in the description. A pin that no longer resolves is reported with the version that does, as a separate change for you to approve.

More Docker jobs

More jobs like this: Fix a bug from an alert

Keep reading