crane
is a tool for interacting with remote images
and registries.
A collection of useful things you can do with crane
is here.
Download latest release:
$ VERSION=TODO # Latest, or other
$ OS=Linux # or Darwin, Windows
$ ARCH=x86_64 # or arm64, x86_64, armv6, i386, s390x
$ curl -sL "https://github.com/google/go-containerregistry/releases/download/v${VERSION}/go-containerregistry_${VERSION}_${OS}_${ARCH}.tar.gz" > go-containerregistry.tar.gz
We generate SLSA 3 provenance using the OpenSSF's slsa-framework/slsa-github-generator. To verify our release, install the verification tool from slsa-framework/slsa-verifier#installation and verify as follows:
$ curl -sL https://github.com/google/go-containerregistry/releases/download/v${VERSION}/attestation.intoto.jsonl > provenance.intoto.jsonl
$ slsa-verifier -artifact-path go-containerregistry.tar.gz -provenance provenance.intoto.jsonl -source github.com/google/go-containerregistry -tag "v${VERSION}"
PASSED: Verified SLSA provenance
Install manually:
go install github.com/google/go-containerregistry/cmd/crane@latest
If you're macOS user and using Homebrew, you can install via brew command:
$ brew install crane
If you're arch linux user and use some AUR helper you can install it with one of your favourite command:
$ yay -S go-crane-bin
You can use the setup-crane
action
to install crane
and setup auth to GitHub Container
Registry in a GitHub Action workflow:
steps:
- uses: imjasonh/[email protected]
You can also use crane as docker image
$ docker run --rm gcr.io/go-containerregistry/crane ls ubuntu
10.04
12.04.5
12.04
12.10
And it's also available with a shell, at the :debug
tag:
docker run --rm -it --entrypoint "/busybox/sh" gcr.io/go-containerregistry/crane:debug
Tagged debug images are available at gcr.io/go-containerregistry/crane/debug:[tag]
.
# Tags an existing Docker image which was tagged with the short commit hash with the tag 'latest'
docker-tag-latest:
stage: latest
only:
refs:
- main
image:
name: gcr.io/go-containerregistry/crane:debug
entrypoint: [""]
script:
- crane auth login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- crane tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA latest