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 [repository] [flags]

PARAMETERS

repository
    The name of the image repository (e.g., gcr.io/google-containers/pause) from which to list tags. This argument is required.

--config path
    Specifies the path to a crane configuration file, typically used for authentication credentials. If not provided, crane will look for standard Docker configuration files.

--insecure
    Allows connecting to registries over HTTP or with self-signed certificates, bypassing TLS verification. Use with caution.

--json
    Outputs the list of tags in JSON format, which is useful for programmatic consumption. By default, tags are listed one per line.

--verbose, -v
    Enables verbose logging, displaying more detailed information about the operation, including HTTP requests and responses.

DESCRIPTION

The `crane-ls` command is a subcommand of the `crane` utility, which is part of the `go-containerregistry` project developed by Google. `crane` is a command-line tool designed for interacting with container registries without requiring a Docker daemon.

The `ls` subcommand specifically allows users to list all tags associated with a given image repository in a remote container registry. This is useful for inspecting the contents of a registry, discovering available image versions, or verifying successful image pushes. It provides a lightweight alternative to complex Docker operations for simply inspecting available tags.

It is particularly useful in CI/CD pipelines or minimalistic environments where a full Docker daemon might be overkill or unavailable. `crane-ls` supports various registry authentication methods and works with most OCI-compliant registries.

CAVEATS

`crane-ls` requires network access to the target container registry.
For private registries, appropriate authentication (e.g., via `docker login` or `--config`) is necessary.
Public registries might enforce rate limiting, potentially affecting large or frequent requests.
Listing tags for repositories with a very large number of tags (thousands) might be slow or hit API limits.

REGISTRY AUTHENTICATION

By default, `crane` attempts to use existing credentials found in the standard Docker configuration file (typically `~/.docker/config.json`). If this file does not exist or does not contain the necessary credentials, you might need to use `docker login`, `crane auth login`, or provide a custom configuration file via the `--config` flag to authenticate with private registries.

OCI COMPLIANCE

`crane` is built to be compatible with OCI (Open Container Initiative) compliant registries. This broad compatibility ensures it works seamlessly with popular registry services like Docker Hub, Google Container Registry (GCR), Amazon Elastic Container Registry (ECR), Quay.io, Azure Container Registry (ACR), and many others.

HISTORY

`crane` is an open-source project developed by Google as part of the `go-containerregistry` suite of tools and libraries. It was designed to provide a lightweight and daemonless method for interacting with OCI-compliant container registries. The `ls` subcommand has been a fundamental part of `crane` since its early development, offering a simple way to inspect registry contents. It has continuously evolved alongside OCI standards and registry capabilities.

SEE ALSO

crane(1), docker(1), podman(1), skopeo(1), regctl(1)

Copied to clipboard