21zoo Labs - Assorted Stuff

Delete a Tag from Docker Hub

Posted at — Mar 20, 2019

First, authenticate with Docker Hub:

export USERNAME="<< your Docker Hub username >>"
export PASSWORD="<< your Docker Hub password >>"

TOKEN=`curl -s -H "Content-Type: application/json" -X POST \
-d '{"username": "'$USERNAME'", "password": "'$PASSWORD'"}' \
https://hub.docker.com/v2/users/login/ | jq -r .token`

Now delete the image tag:

export ORG="oliver006"
export IMAGE="drone-gcf"
export TAG="tst"

curl 'https://hub.docker.com/v2/repositories/${ORG}/${IMAGE}/tags/${TAG}/' \
-X DELETE \
-H "Authorization: JWT ${TOKEN}"