LinuxCommandLibrary

gcrane-copy

Copy container images between registries

TLDR

Copy an image from source to target

$ gcrane [[cp|copy]] [source] [target]
copy

Set the maximum number of concurrent copies, defaults to 20
$ gcrane copy [source] [target] [[-j|--jobs]] [nr_of_copies]
copy

Whether to recurse through repositories
$ gcrane copy [source] [target] [[-r|--recursive]]
copy

Display help
$ gcrane copy [[-h|--help]]
copy

SYNOPSIS

gcrane-copy [options] <SRC> <DST>

PARAMETERS

--platform value
    Copy only images for specified platform(s), e.g. linux/amd64 or multiple comma-separated

--preserve-digests
    Preserve image digests on push (default: true)

--pull-from-client
    Pull from local Docker daemon first if available (default: true)

--insecure-skip-tls-verify
    Skip TLS verification for registries (use cautiously, default: false)

--log-http
    Log full HTTP requests/responses for debugging

-v, --verbose
    Enable verbose logging

--debug
    Enable debug-level logging

DESCRIPTION

The gcrane-copy command, part of Google's go-containerregistry toolkit, enables efficient copying of container images between Google Container Registry (GCR) repositories. It fetches images from a source registry (typically gcr.io or gcr-test.io) and pushes them to a destination, preserving digests, layers, manifests, and multi-platform support where specified.

This tool is particularly useful for image migration across GCR projects, replication for redundancy, or promoting images between environments like dev to prod. It operates directly on registry APIs without requiring Docker daemon, making it lightweight and suitable for CI/CD pipelines.

Key features include selective platform copying (e.g., only linux/amd64), optional digest preservation to ensure reproducibility, and pulling from local Docker if images are cached. Authentication relies on gcloud credentials or standard Docker config (~/.docker/config.json).

While powerful, it's optimized for GCR; for arbitrary OCI registries, use the sibling crane copy command. Output includes progress bars for uploads/downloads, and verbose logging for troubleshooting.

CAVEATS

Specific to GCR.io/gcr-test.io; deprecated in favor of crane copy. Requires gcloud auth login or Docker config. Large images may timeout without sufficient quotas.

EXAMPLES

gcrane-copy gcr.io/myproj/app:v1 gcr.io/myproj/app:v2
gcrane-copy --platform=linux/amd64,linux/arm64 gcr.io/src/app:latest gcr.io/dest/app:latest

INSTALLATION

Install via go install github.com/google/go-containerregistry/cmd/gcrane@latest or binaries from GitHub releases.

HISTORY

Introduced in 2018 with go-containerregistry v1.0 for simplifying GCR workflows. Evolved through 2020s but phased out post-GCR deprecation in 2023/2024 toward Artifact Registry; now recommends universal crane.

SEE ALSO

crane(1), skopeo-copy(1), docker(1), gcloud-container(1)

Copied to clipboard