Skip to content

Instantly share code, notes, and snippets.

@Sakib37
Created August 5, 2019 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sakib37/b33b73302c4518fa7e967975eed90804 to your computer and use it in GitHub Desktop.
Save Sakib37/b33b73302c4518fa7e967975eed90804 to your computer and use it in GitHub Desktop.
source:
Docker API V2: https://docs.docker.com/registry/spec/api/
Artifactory docker registry commands: https://www.jfrog.com/confluence/display/RTF/Docker+Registry
REGISTRY_NAME=https://my-docker-registry.com
List images:
============
The following commands by default shows only 100 images. To see all images add a high pagination "?n=3000"
no-password:
curl -s ${REGISTRY_NAME}/v2/_catalog | jq .
or
curl -s ${REGISTRY_NAME}/v2/_catalog?n=3000 | jq .
with-username-password:
curl -u user:pass ${REGISTRY_NAME}/v2/_catalog | jq .
with Token:
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${UNAME}'", "password": "'${UPASS}'"}' https://${REGISTRY_NAME/v2/users/login/ | jq -r .token)
curl -s -H "Authorization: JWT ${TOKEN}" https://${REGISTRY_NAME/v2/_catalog
For Artifactory:
curl -H "X-JFrog-Art-Api:$TOKEN" https://${REGISTRY_NAME/v2/_catalog
List tags:
==========
curl -u user:pass ${REGISTRY_NAME}/v2/${IMAGE_NAME}/tags/list
Delete image tag:
================
curl -u<user:password> -X DELETE <ArtifactoryURL>/<Local-Docker-Repo-Name>/<Image-name>/<Tag>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment