regclient / regclient

Docker and OCI Registry Client in Go and tooling using those libraries.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] buildx imagetools create alternative

pschulten opened this issue · comments

Question

I'm currently building multiple images for different architectures and then combine them with:

docker buildx imagetools create -t $REF $REF-amd64 $REF-arm64

Is this also possible with regctl?

Version

VCSTag:     v0.5.7
VCSRef:     832109d4e9ef96982c4a4a8614b276b752509e5b
VCSCommit:  832109d4e9ef96982c4a4a8614b276b752509e5b
VCSState:   clean
VCSDate:    2024-02-06T21:25:52Z
Platform:   linux/arm64
GoVer:      go1.21.6
GoCompiler: gc

Yes, regctl index create is used for that:

$ regctl index create --help
Create a manifest list or OCI Index.

Usage:
  regctl index create <image_ref> [flags]

Aliases:
  create, init, new

Examples:

# create an empty index
regctl index create registry.example.org/repo:v1

# create an index from the amd64 and arm64 platforms
regctl index create registry.example.org/alpine:latest \
  --ref alpine:latest --platform linux/amd64 --platform linux/arm64

# create a docker manifest list
regctl index create registry.example.org/busybox:1.34 \
  --media-type application/vnd.docker.distribution.manifest.list.v2+json \
  --ref busybox:1.34 --platform linux/amd64 --platform linux/arm64

# create an index of windows images
regctl index create registry.example.org/library/golang:windows \
  --ref golang:latest \
        --platform windows/amd64,osver=10.0.20348.2322 \
        --platform windows/amd64,osver=10.0.17763.5458

Flags:
      --annotation stringArray        Annotation to set on manifest
      --artifact-type string          Include an artifactType value
      --by-digest                     Push manifest by digest instead of tag
      --desc-annotation stringArray   Annotation to add to descriptors of new entries
      --desc-platform string          Platform to set in descriptors of new entries
      --digest stringArray            Digest to include in new index
      --digest-tags                   Include digest tags
      --format string                 Format output with go template syntax
  -h, --help                          help for create
  -m, --media-type string             Media-type for manifest list or OCI Index (default "application/vnd.oci.image.index.v1+json")
      --platform stringArray          Platforms to include from ref
      --ref stringArray               References to include in new index
      --referrers                     Include referrers
      --subject string                Specify a subject tag or digest (this manifest must already exist in the repo)

The equivalent command would be:

regctl index create create $REF --ref $REF-amd64 --ref $REF-arm64

Wonderful, thank you very much!