Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get docker image tags from Gitlab Registry
#/bin/bash
set -e
AUTH_URL="https://gitlab.com/jwt/auth"
SERVICE="container_registry"
SCOPE="repository:group_name/image_name:pull"
AUTH="some_passowrd"
TOKEN=$(curl -s -H "Authorization: Basic ${AUTH}" "${AUTH_URL}?service=${SERVICE}&scope=${SCOPE}" | jq '.token' -r )
ACCEPT_HEADER="Accept: application/vnd.docker.distribution.manifest.v2+json"
API_URL="https://gitlab.com:5005/v2"
REPO="group_name/image_name"
curl -H "${ACCEPT_HEADER}" -H "Authorization: Bearer ${TOKEN}" "${API_URL}/${REPO}/tags/list"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment