Skip to content

feat(oci): directly load from cache if possible - #14466

Merged
ndeloof merged 1 commit into
docker:mainfrom
gzm0:14460-short
Nov 26, 2026
Merged

ndeloof merged 1 commit into
docker:mainfrom
gzm0:14460-short

Conversation

@gzm0

@gzm0 gzm0 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

If an oci artifact is sha-pinned and we have it in the cache, don't
even talk to the registry.

The primary use case is operational safety in case of registry failure:
This allows to still work with a compose config that
includes: oci:// if it has been pulled before.

This aligns the behavior with docker itself: images are kept locally,
so it is not necessary for the registry to be up to, say, recreate an
existing container with a modified environment.

Related issue

Fixes #14460.

Changes made

  • Check eagerly if ref digest exists in cache
  • Add test.

Testing done

  • Unit tests pass: make test
  • E2E tests pass: make e2e-compose or make e2e-compose-standalone (fail locally, looks like infrastructure failure, similar failures on main)
  • Linting passes: make lint
  • Code formatted: make fmt
  • Manually tested (describe): checked that test fails w/o fix.

Additional context

Depends / based on #14462

image

@gzm0

gzm0 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Draft because of the base PR.

@gzm0
gzm0 marked this pull request as ready for review November 7, 2026 07:55
@gzm0
gzm0 requested review from a team as code owners November 7, 2026 07:55
@gzm0
gzm0 requested review from glours and ndeloof November 7, 2026 07:55
@gzm0

gzm0 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor Author

Rebased on main. Ready for review.

@ndeloof

ndeloof commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

we released v5.7.1 with some significant changes in the oci cache layout, please rebase (again) - sorry for the mess

@gzm0

gzm0 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Heh, I was about to do this. Rebased now.

@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/remote/oci.go 85.71% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@gzm0

gzm0 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

The riscv64 build seems to also fail on main because of a missing image?

@gzm0

gzm0 commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

I've re-based onto main because the coverage data looked liked the diffbase is old:

image

@gzm0

gzm0 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Rebased.

Fixes docker#14460.

If an oci artifact is sha-pinned and we have it in the cache, don't
even talk to the registry.

The primary use case is operational safety in case of registry failure:
This allows to still work with a compose config that
`includes: oci://` if it has been pulled before.

This aligns the behavior with docker itself: images are kept locally,
so it is not necessary for the registry to be up to, say, recreate an
existing container with a modified environment.

Signed-off-by: Tobias Schlatter <schlatter.tobias@gmail.com>
@gzm0

gzm0 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Rebased.

@ndeloof I'm permitting myself to mention you explicitly here (since it seems you've been somewhat actively working on the oci subsystem).

Is there anything I can do to move this forward? Having a solution for oci includes to work when our main registry is down is important to us.

Any chance you could give me a gut feeling of whether the overall idea seems reasonable and mergeable?(Independent of the specific code / implementation, I'm just trying to figure out if I need to look for other solutions).

TY!!

@ndeloof ndeloof left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Comment thread pkg/remote/oci.go

// if the ref has a digest eagerly look in the local cache.
// (still works if the registry is down)
if ref, ok := ref.(reference.Digested); ok {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ref shadows the outer ref here; if digested, ok := ref.(reference.Digested); ok reads better.

@ndeloof
ndeloof enabled auto-merge (rebase) November 26, 2026 14:56
@ndeloof
ndeloof merged commit e68a657 into docker:main Nov 26, 2026
61 checks passed
@gzm0

gzm0 commented Nov 26, 2026

Copy link
Copy Markdown
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oci: do not round-trip to registry when a pinned manifest is available locally

2 participants