Created
March 12, 2021 15:34
-
-
Save davidthewatson/d717af6d34f62d8d933635b5b6c23e2f to your computer and use it in GitHub Desktop.
Revisions
-
davidthewatson created this gist
Mar 12, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ #!/bin/bash # get username and password echo "Username?" read UNAME echo "Password?" read UPASS echo "This will delete ever repo in your dockerhub. Ctrl-C to end." read set -e echo # aquire token TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${UNAME}'", "password": "'${UPASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token) # get list of repositories for the user account REPO_LIST=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${UNAME}/?page_size=100 | jq -r '.results|.[]|.name') # delete every repo in list for i in ${REPO_LIST} do curl -X DELETE -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${UNAME}/${i}/ done