Skip to content

Instantly share code, notes, and snippets.

@eggplants
eggplants / ghcr.sh
Last active May 31, 2025 19:27
How to get information from ghcr Docker Registry HTTP API V2 with curl
#!/usr/bin/env bash
# ref: https://git.521000.bestmunity/t/how-to-check-if-a-container-image-exists-on-ghcr/154836/3
# public image's {USER}/{IMAGE}
USER_IMAGE=eggplants/asciiquarium-docker
# get token ('{"token":"***"}' -> '***')
TOKEN="$(
curl "https://ghcr.io/token?scope=repository:${USER_IMAGE}:pull" |
awk -F'"' '$0=$4'