crane ls: List Tags in a Repository
crane ls lists every tag in a repository, printed one per line straight from the registry.
crane ls is the lightweight way to enumerate tags in CI. Unlike skopeo it prints plain lines, which pipes directly into shell loops for cleanup or release checks.
What it does
crane ls <repository> queries the registry tag-listing endpoint and prints each tag on its own line. Because the output is line-oriented (not JSON), it feeds straight into grep, sort, and while-read loops without needing jq.
Common usage
crane ls ghcr.io/org/app
# find and delete tags matching a pattern
crane ls ghcr.io/org/app | grep '^pr-' | while read t; do
crane delete ghcr.io/org/app:$t
doneOptions
| Flag / usage | What it does |
|---|---|
| crane ls <repo> | List all tags in the repository |
| --insecure | Allow plain HTTP / skip TLS (testing) |
| crane auth login | Authenticate for private repositories |
| crane delete <ref> | Delete a tag found via ls |
In CI
Pipe crane ls into a filter and a delete loop to prune ephemeral CI tags (per-PR or per-commit images). Authenticate first with crane auth login. Because the output is plain text, it is the simplest tag source for shell-driven cleanup jobs.
Common errors in CI
"UNAUTHORIZED" means the repository is private and crane is not logged in. "NAME_UNKNOWN: repository name not known to registry" means the repository path is wrong (note: pass the repository, not a tagged reference). A delete loop failing with "DENIED" means the token lacks delete scope or the registry disables deletion.