Skip to content

Tolerate sparse OCI images on import. - #961

Merged
jglogan merged 1 commit into
apple:mainfrom
jglogan:fix/tolerate-sparse-index-on-load
Oct 12, 2026
Merged

jglogan merged 1 commit into
apple:mainfrom
jglogan:fix/tolerate-sparse-index-on-load

Conversation

@jglogan

@jglogan jglogan commented Oct 9, 2026

Copy link
Copy Markdown
Contributor
  • Closes [Request]: Tolerate sparse OCI images on import. #959.
  • When importing from an OCI layout, tolerate manifests listed by an index that are not in the archive. Import the platforms that are present, and keep the original index so the stored image looks like a container image pull of the native platform only.
  • Keep failing when a platform whose manifest is present is missing its config or layers.
  • If none of the platforms listed by the index are present, fail with an error that names the missing platforms and manifest digests instead of a bare missingContent(<digest>).

- Closes apple#959.
- When importing from an OCI layout, tolerate manifests
  listed by an index that are not in the archive.
  Import the platforms that are present, and keep the
  original index so the stored image looks like
  a `container image pull` of the native platform only.
- Keep failing when a platform whose manifest is present
  is missing its config or layers.
- If none of the platforms listed by the index are
  present, fail with an error that names the missing
  platforms and manifest digests instead of a bare
  `missingContent(<digest>)`.
@jglogan
jglogan merged commit d7b18a1 into apple:main Oct 12, 2026
7 checks passed
benoitf pushed a commit to socktainer/socktainer that referenced this pull request Oct 20, 2026
)

* deps: bump apple/container to 1.6.0 and containerization to 0.52.1

apple/container 1.6.0 pins containerization 0.52.1. The one source
change it needs is in ExtraHostsFile: NetworkClient.lookup(hostname:)
is now lookup(name:), and it returns a NetworkMatch wrapping the
Attachment, since a name can now also match an attachment's DNS alias
(apple/container#2390).

That lookup's XPC message changed with it: a 1.6.0 network plugin reads
only the new `name` key and a 1.5.0 one reads only `hostname`. A
socktainer built against one version cannot look up attachments on the
other, so socktainer and Apple Container have to move together.

The release also brings, with no change here:

- A fix to BuildFSSync.read()/info(), which checked a context path and
  then opened it again, so a symlink swapped in between could escape
  the build context (apple/container#2415). Symlinks with absolute
  targets are now rejected on that fallback path.
- container-builder-shim 0.13.2 as the default builder image.
- Sparse OCI images load on import (apple/containerization#961).

Co-authored-by: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wes Morgan <[email protected]>

* refactor(builder): start BuildKit with apple/container's Builder.start

apple/container 1.6.0 moved the builder bootstrap that `container build`
uses out of the CLI and into the ContainerBuild library as
Builder.start (apple/container#2370). ClientBuilderService had its own
copy, which has drifted from upstream before: #260 was the copy missing
upstream's capAdd = ["ALL"].

Hand the non-running cases to Builder.start instead. It creates the
"buildkit" container, restarts a stopped one, and recreates one whose
image, CPUs, memory or DNS no longer match the system configuration.
That last part is new for socktainer, which never replaced an existing
builder before. A builder created before an upgrade now moves to the new
default image the next time it has to be started. A builder that is
already running is still used as it is, so a build in progress is never
interrupted.

Behavior differences from the old copy:

- CPUs and memory come from the [build] section of the system
  configuration (default 2 CPUs and 2048MB, the values that were
  hard-coded here), so socktainer and `container build` agree on the
  shared builder instead of each recreating it to its own settings.
- The nameserver is no longer set explicitly. The runtime fills in the
  network's gateway when none is given, the same address socktainer
  computed.
- A builder in an unknown state is bootstrapped again instead of being
  deleted first. If that fails, Builder.start deletes it and the next
  request creates a new one.

Builder.start fetches the image over HTTPS only, so socktainer still
fetches it first with the scheme it picks for the reference. A builder
image on a local insecure registry keeps working, and Builder.start
finds it already in the store.

The builderContainerConfiguration tests go with the code they covered.
Those settings are now upstream's.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wes Morgan <[email protected]>

* fix(builder): don't fail a builder restart on the image pre-fetch

startBuilder fetched the builder image, with the scheme its reference
calls for, before handing over to Builder.start, and failed if that
fetch did. Builder.start restarts a stopped builder that still matches
without touching its image, which may since have been deleted (Apple
Container only protects images of running containers), so an
unreachable registry would fail a restart that needs no image. Make the
pre-fetch best effort and log its failure: Builder.start still fails,
with its own fetch, when it does need the image.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wes Morgan <[email protected]>

* ci: retrigger integration test

The previous two runs' integration jobs failed on infrastructure: a dropped kernel download, then no macOS runner acquired.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Signed-off-by: Wes Morgan <[email protected]>

---------

Signed-off-by: Wes Morgan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

[Request]: Tolerate sparse OCI images on import.

2 participants