Skip to content

Instantly share code, notes, and snippets.

@aweiteka
Last active August 29, 2015 14:22
Show Gist options
  • Select an option

  • Save aweiteka/c5222f03673dc06e4a47 to your computer and use it in GitHub Desktop.

Select an option

Save aweiteka/c5222f03673dc06e4a47 to your computer and use it in GitHub Desktop.
test docker registry API
#!/bin/bash
# curl -v $hostname/<path> --key /etc/pki/entitlement/<id>-key.pem --cert /etc/pki/entitlement/<id>.pem --cacert cert.crt
# docker pull calls
#/v1/_ping
#/v1/repositories/acme/app/images
#/v1/repositories/acme/app/tags
# these are all redirects
#/v1/images/5f28cecd443d0503f9350f690ae6896b3e18e6c8ae59e9556b6ac157180b61e7/ancestry
#/v1/images/5f28cecd443d0503f9350f690ae6896b3e18e6c8ae59e9556b6ac157180b61e7/json
#/v1/images/5f28cecd443d0503f9350f690ae6896b3e18e6c8ae59e9556b6ac157180b61e7/layer
URL=$1
IMAGE=$2
# index.docker.io
echo "Ping:"
curl -i -X GET ${URL}/v1/_ping
echo ""
echo ""
echo "Tags:"
curl -i -X GET ${URL}/v1/repositories/${IMAGE}/tags
echo ""
echo ""
echo "Tags (JSON):"
curl -s -X GET ${URL}/v1/repositories/${IMAGE}/tags | python -m json.tool
echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment