LinuxCommandLibrary

crane-ls

List content in remote container registries

TLDR

List the tags

$ crane ls [repository]
copy

Print the full image reference
$ crane ls [repository] --full-ref
copy

Omit digest tags
$ crane ls [[-o|--omit-digest-tags]]
copy

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

SYNOPSIS

crane ls [flags] IMAGE

PARAMETERS

IMAGE
    The name of the image/repository in the container registry. For example, 'gcr.io/my-project/my-image' or 'docker.io/library/nginx'.

--platform string
    Filter by platform. Format is os/arch[/variant] (e.g., linux/amd64). If empty, lists images for all platforms.

--raw
    Outputs the image tags in raw format, meaning no formatting or prefixes are added.

--insecure
    Allow insecure connections (e.g., to registries using HTTP instead of HTTPS). Not recommended for production use.

DESCRIPTION

crane ls is a command-line tool primarily used to list the tags or repositories within a container registry. It allows users to explore the contents of a container registry without needing to pull the images locally. This is particularly useful for discovering available image tags, understanding the structure of a registry, and managing container image assets. It supports various container registries, including Docker Hub, Google Container Registry (GCR), and other OCI-compliant registries. The tool integrates seamlessly with tools like crane copy and crane delete providing a complete solution for managing your container images.

It leverages standard container registry APIs to fetch the list of tags or repositories, making it a lightweight and efficient way to interact with container registries. Users can specify the registry URL, image name, and other options to filter the results. This command can be extremely useful in CI/CD pipelines or automation scripts where programmatic listing of container images is required.

CAVEATS

Authentication to private registries may require configuring docker login or similar authentication mechanisms before using crane ls.
The exact output format can vary slightly depending on the registry implementation.

EXAMPLES

List all tags for an image on Docker Hub:
crane ls docker.io/library/nginx

List all tags for an image on GCR:
crane ls gcr.io/my-project/my-image

List all tags for a specific platform
crane ls --platform linux/arm64 gcr.io/my-project/my-image

SEE ALSO

crane copy(1), crane delete(1), docker(1)

Copied to clipboard