gcrane
Copy container images to/from registries
TLDR
Execute a gcrane subcommand
Allow pushing non-distributable (foreign) layers
Allow image references to be fetched without TLS
Specify the platform in the form os/arch/variant:osversion (e.g. linux/amd64). (default all)
Enable debug logs
Display help
SYNOPSIS
gcrane command [ options... ]
Where command refers to a subcommand of the underlying `crane` tool, such as `pull`, `push`, `copy`, or `delete`. `gcrane` handles the necessary authentication to Google Cloud registries automatically.
PARAMETERS
pull
Pulls an image from a Google Cloud registry to local storage or stdout.
push
Pushes an image or OCI layout to a Google Cloud registry.
copy
Copies an image from one Google Cloud registry or any other registry to another.
delete
Deletes an image or tag from a Google Cloud registry.
ls
Lists all tags for a given repository in a Google Cloud registry.
digest
Retrieves the manifest digest for a specific image in a Google Cloud registry.
config
Fetches the image configuration (OCI config) for an image from a Google Cloud registry.
tag
Adds or removes tags on an image in a Google Cloud registry.
mutate
Applies modifications to an image's manifest (e.g., adding layers, changing config).
DESCRIPTION
`gcrane` is a specialized command-line tool designed to simplify interactions with Google Container Registry (GCR) and Artifact Registry. It acts as a convenient wrapper around the powerful crane utility from the go-containerregistry project.
Its primary benefit lies in automating authentication to Google Cloud's various container image services, leveraging your existing `gcloud` credentials. While `crane` itself provides extensive functionality for manipulating container images, `gcrane` removes the complexity of manual authentication setup, allowing users to seamlessly perform operations like pulling, pushing, copying, and deleting images and tags within the Google Cloud ecosystem. It's particularly useful for CI/CD pipelines and scripting where seamless interaction with Google Cloud's container registries is required without manual credential management.
CAVEATS
Not a standard Linux distribution command; it must be installed separately. It relies heavily on `gcloud` for authentication, so `gcloud` must be configured and authenticated to your Google Cloud project.
While it simplifies GCR/Artifact Registry interactions, understanding the underlying `crane` commands and image registry concepts is still beneficial.
AUTHENTICATION
The primary benefit of `gcrane` is its automatic authentication. It uses your default `gcloud` credentials to authenticate requests to Google Container Registry and Artifact Registry. This means you do not need to manually configure Docker credential helpers or pass explicit authentication tokens, making it ideal for scripts and CI/CD environments where `gcloud` is already configured.
INSTALLATION
`gcrane` is typically installed as a Go binary. You can usually find pre-built binaries on its GitHub releases page, or compile it from source if Go is installed:
go install github.com/google/go-containerregistry/cmd/gcrane@latest
HISTORY
`gcrane` is part of the broader `go-containerregistry` project, which is a collection of Go libraries and tools for working with OCI (Open Container Initiative) image formats and registries. Developed by Google, `gcrane` specifically emerged to streamline the authentication challenges faced when using `crane` directly with Google Container Registry and Artifact Registry, thereby enhancing usability for Google Cloud users. Its development reflects the increasing need for programmatic and scripting-friendly interactions with container registries in modern cloud-native workflows.