LinuxCommandLibrary

crane-index

Generate an index for container images

TLDR

Modify an image index

$ crane index
copy

Modify an image index with subcommand
$ crane index [subcommand]
copy

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

SYNOPSIS

crane index [flags] REGISTRY/REPOSITORY

PARAMETERS

--platform PLATFORM
    Filter images by platform (e.g., linux/amd64). Can be repeated.

--remote
    Use remote registry API instead of local image.

--raw
    Prints the raw manifests without filtering or modification.

REGISTRY/REPOSITORY
    The registry and repository to index (e.g., docker.io/library/alpine).

DESCRIPTION

crane index is a command-line tool that indexes container images within a Crane registry.
It essentially lists all available images within a specified repository or the entire registry. This is achieved by querying the registry's API, retrieving metadata about available image tags and digests, and then presenting the information to the user. It's commonly used to discover available images, understand versioning schemes used within a registry, and to programmatically iterate over the images for tasks such as security scanning, vulnerability assessment, or automated deployment workflows.
The output of crane index is typically a list of image tags, which can be piped to other commands or scripts for further processing. While useful, it may not display all manifest list indexes, relying on specific registry support or flags.

ERROR HANDLING

If the specified registry or repository does not exist, or if the user lacks the necessary permissions to access the registry, crane index will return an error. Similarly, network connectivity issues can also lead to errors.

AUTHENTICATION

crane index can authenticate against private registries using credentials provided through environment variables (e.g., DOCKER_USERNAME, DOCKER_PASSWORD) or the ~/.docker/config.json file. Authentication is crucial for accessing and indexing images in private repositories.

OUTPUT FORMAT

The default output is a simple list of tags. Other tools like jq can be used to parse the results. It's not natively able to directly provide information on the size, creation dates, or other detailed metadata beyond the tag names.

SEE ALSO

crane copy(1), crane manifest(1), crane pull(1), docker(1)

Copied to clipboard