Skip to content

fix(local): an image Docker holds by its digest is used as pinned, not pulled or built again - #894

Merged
earakely-scale merged 3 commits into
mainfrom
edgararakelyan/fd-6895-a-run-re-pulls-an-image-it-already
Nov 23, 2026
Merged

earakely-scale merged 3 commits into
mainfrom
edgararakelyan/fd-6895-a-run-re-pulls-an-image-it-already

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

What

A run that pins an image to a digest (a bundle's image = { ref = "<repo>@sha256:…", dockerfile = … }, a published image) now uses that image when this machine's Docker already holds it by its digest, without asking the registry, and no longer takes whatever the image's name holds as the pinned image.

Before, the local provider asked only whether Docker held something under the image's name:

  • An image pulled by its digest alone looked absent. docker pull <repo>@<digest> leaves an image with no tag, so the run pulled again. On a machine not logged in to the registry (a private ECR image on a test VM), Docker's containerd image store refuses that pull. The run then built the image from its build context in its place, and ran that, or failed when the Dockerfile's base was private too.
  • A name that held another image was trusted. On a gateway deploy the local sandbox skipped any image present under its name, so a name another image had taken ran that image.

host_images.named_if_held now decides for both the local provider's pull and the local sandbox's published images. An image counts as held when:

  • its name holds the digest;
  • or its name holds a build here of the image's sources, as before;
  • or Docker holds the digest alone (inspected by the pinned reference). The image is then named with its name, over whatever that name held, as a pull names it. Moving the name off another image is logged as a warning, since a container started by that name then runs something else than before.

Docker resolves a pinned reference (<repo>[:<tag>]@<digest>) on both its classic and containerd image stores. Checked on Docker 29 (containerd store) and Docker 27 (classic store): docker image inspect finds an image held by its digest alone, and docker tag names it.

Unchanged: an image Docker doesn't hold by its digest is pulled, and built from its build context when the pull fails. A build of the image's sources here still counts as holding it, so after a fallback build a later run uses that build even once the registry is reachable again.

FD-6895.

Proof

  • Unit tests:

    • named_if_held for each case: held under its name, by its digest alone (named), by its digest with its name on another image (renamed), its name on another image only (not held), absent.
    • pull names a digest-only image without pulling or building, with the registry refusing.
    • The warning is logged only when the name held another image.
    • The local sandbox pulls only the published images named_if_held says aren't held.
    • The new pull tests fail on main's code.
    • Provider, bundle and env unit tests: 5,975 passed, 18 skipped, ruff clean. One Windows launcher-script test fails on macOS only, on main too.
  • End to end, on an agent-environments-admin KVM host, main against this branch. The echo-mcp example, its MCP server image pinned by digest in a registry that needs a login (registry:2 with htpasswd), its Dockerfile built FROM that private image. Docker holds the image by its digest alone, logged out. Run on both of Docker's image stores:

    Case Classic store (overlay2) Containerd store
    main, digest held alone passes: Docker pulls a digest it holds without asking the registry the bug: "Couldn't pull …, so it's built from its build context", then runs an image built here (d439530c1112), not the pinned one (875e55b37400)
    this branch, digest held alone passes on the pinned image, no pull passes on the pinned image, no pull, no build
    the image's name on another image first renamed to the pinned image, passes renamed to the pinned image, passes
    two runs at once both pass both pass
    image gone, logged out fails at once: "Couldn't pull …, so it's built from its build context", the private base refusing the build the same fallback, built from the build cache
    image gone, logged in pulled, passes uses the build of its sources the run before made

    In the first round, before the local sandbox's check moved to named_if_held, the renamed-name case ran the other image (a QEMU launcher, as the echo server). No sandbox, container or folder was left after either round.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with no outstanding findings.

Summary

Local Docker reuses images already held by their pinned digest and gives them the expected name.

  • Local runs use the image that matches the pinned digest.

Reviews (8) · Last reviewed commit: "refactor(local): leave named_if_held the..." · Reviewed by Greptile

…t pulled or built again

A run pinning an image to a digest asked only whether this machine held something under the image's name. An image
pulled as `docker pull <repo>@<digest>` carries no tag, so it looked absent: the run pulled again and, on a machine not
logged in to the registry, built the image from its build context in its place, or failed when its Dockerfile's base
was private too. And a gateway deploy on the local provider took whatever the name held as the pinned image, even
another one.

`named_if_held` decides for both the local provider's pull and the local sandbox's published images: held when the
name holds the digest, or a build here of the image's sources, or when Docker holds the digest alone, which it then
names with the image's name, over whatever that name held. Docker resolves the pinned reference on both its classic and
containerd image stores.

Fixes FD-6895.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale requested a review from a team as a code owner November 23, 2026 19:23
earakely-scale and others added 2 commits November 23, 2026 11:58
A container started by the name runs something else than before, which is worth a line in the log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… image held here

holds_digest misses an image held by its digest alone, the check this pull request replaced in pull_published, so as a
public name it invited the same mistake again. It's now _holds_under_name, a step of named_if_held.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@earakely-scale
earakely-scale merged commit 1ece3a5 into main Nov 23, 2026
83 of 91 checks passed
@earakely-scale
earakely-scale deleted the edgararakelyan/fd-6895-a-run-re-pulls-an-image-it-already branch November 23, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant