LinuxCommandLibrary

gcrane-ls

List container image tags and repositories

TLDR

List the tags

$ gcrane ls [repository]
copy

Format response from the registry as JSON
$ gcrane ls [repository] --json
copy

Whether to recurse through repositories
$ gcrane ls [repository] [[-r|--recursive]]
copy

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

SYNOPSIS

gcrane ls [-f --format] [-i --insecure] [--num-tags=N] <repository>

PARAMETERS

-f, --format=FMT
    Output format: json or text (default: text)

-i, --insecure
    Allow connections to HTTP registries (insecure)

--num-tags=N
    Maximum number of tags to list per image (default: 10)

--platform=PLATFORM
    Filter by platform architecture (e.g., linux/amd64)

DESCRIPTION

The gcrane ls command is a tool for listing images stored in Google Container Registry (GCR) repositories. It displays digests, tags, and other metadata for container images in a specified repository path, such as gcr.io/project/image. Designed for efficient interaction with GCR's OCI-compatible registry, it supports JSON output for scripting and automation.

gcrane is a lightweight, standalone binary developed by Google, offering faster performance than full SDK tools for simple listing operations. It retrieves image manifests without pulling layers, making it ideal for inventory management, CI/CD pipelines, and repository audits. Output includes image digests, tags, and sizes, helping users identify outdated or unused images.

While powerful, note that gcrane requires authentication via gcloud auth or service accounts. It's particularly useful in environments with heavy GCR usage before broader adoption of Artifact Registry.

CAVEATS

Deprecated in favor of gcloud container images list-tags; requires gcloud authentication; does not support Artifact Registry.

EXAMPLE USAGE

gcrane ls gcr.io/my-project/my-image
gcrane ls -f json gcr.io/my-project/my-image > images.json

AUTHENTICATION

Run gcloud auth configure-docker first for access.

HISTORY

Introduced by Google in 2019 as part of GCR tooling for OCI compliance. Integrated with crane (OCI Image Tool). Phased out post-2021 with GCR migration to Artifact Registry; last major update ~2022.

SEE ALSO

gcloud(1), crane(1), docker(1)

Copied to clipboard