Skip to content

Commit

Permalink
pkg/build/nodeimage: EditArchive: disable broken OCI in Docker v25
Browse files Browse the repository at this point in the history
`docker save` in Docker v25 produces Docker/OCI dual-format archives:
  - "repositories", "manifest.json": for legacy Docker format
  - "oci-layout", "index.json" (and blobs): for OCI format

However, as of Docker v25.0.0, the OCI format blobs are broken.
See moby/moby issue 47150.

As a workaround, we have to omit "oci-layout" and "index.json" here to disable
the OCI format to avoid confusing `ctr images import`.

When the issue above is fixed, we may add back "oci-layout" and "index.json"
here, but we still have to make sure to update the "io.containerd.image.name"
annotation in manifests in "index.json".

Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Jan 21, 2024
1 parent 78f35c4 commit 11a4351
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/build/nodeimage/internal/container/docker/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,21 @@ func EditArchive(reader io.Reader, writer io.Writer, editRepositories func(strin
return err
}
hdr.Size = int64(len(b))
} else if hdr.Name == "oci-layout" || hdr.Name == "index.json" {
// `docker save` in Docker v25 produces Docker/OCI dual-format archives:
// - "repositories", "manifest.json": for legacy Docker format
// - "oci-layout", "index.json" (and blobs): for OCI format
//
// However, as of Docker v25.0.0, the OCI format blobs are broken:
// https://github.com/moby/moby/issues/47150
//
// As a workaround, we have to omit "oci-layout" and "index.json" here to
// disable the OCI format to avoid confusing `ctr images import`.
//
// When the issue above is fixed, we may add back "oci-layout" and
// "index.json" here, but we still have to make sure to update the
// "io.containerd.image.name" annotation in manifests in "index.json".
continue
// edit image config when we find that
} else if strings.HasSuffix(hdr.Name, ".json") {
if architectureOverride != "" {
Expand Down

0 comments on commit 11a4351

Please sign in to comment.