rashidmd
(Mohd Rashid)
July 14, 2020, 9:18am
1
Hi All,
When i trying to delete public or private repository from docker hub i got error
Command which i was trying to delete from terminal
curl -s -v -H “Authorization: JWT ${HUB_TOKEN}” -X DELETE “https://hub.docker.com/v2/repositories/mohd/test2/ ”
After execute i got error
And also i email to docker support 6 times but they didnt reply to my email
I have many repository which i want to delete it.
kfrajer
(Kfrajer)
July 21, 2020, 9:39pm
2
I suggest the following gist and see if your issue persists. I am pasting it below for completeness.
Kf
#!/bin/bash
# Based on kizbitz/dockerhub-v2-api-organization.sh at https://gist.github.com/kizbitz/175be06d0fbbb39bc9bfa6c0cb0d4721
# Example for the Docker Hub V2 API
# Returns all images and tags associated with a Docker Hub organization account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username, password, and organization
UNAME=""
UPASS=""
ORG=""
# -------
set -e
# get token
echo "Retrieving 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
echo "Retrieving repository list ..."
REPO_LIST=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORG}/?page_size=200 | jq -r '.results|.[]|.name')
# delete images and/or tags
echo "Deleting images and tags for organization: ${ORG}"
for i in ${REPO_LIST}
do
# Delete repo (all)
echo -n "${i}: "
curl -X DELETE -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORG}/${i}/
echo "DELETED"
# Delete by tags (TODO: filter)
#IMAGE_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORG}/${i}/tags/?page_size=300 | jq -r '.results|.[]|.name')
#for j in ${IMAGE_TAGS}
#do
# echo -n " - ${j} ... "
# curl -X DELETE -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORG}/${i}/tags/${j}/
# echo "DELETED"
#done
done
rashidmd
(Mohd Rashid)
July 22, 2020, 5:09am
3
getting the same error after following your script
olafww
(Olaf Reitmaier)
September 10, 2020, 6:39pm
4
I have the same issues, and because of that I can not downgrade and close my account.
What a shitty service! I just lost the count of e-mail I have sent, twitter and even sales, and no response.
rimelek
(Ákos Takács)
May 5, 2022, 3:21pm
6
I tried now with the same result. It looks like the page is not actually reloading after deleting the image (or trying to), it just replaces the URL and changes content. At least this is how it looks like to me. So the API call which would delete the image is probably failing.
I’m going to report it here:
rimelek
(Ákos Takács)
May 5, 2022, 3:46pm
7
Okay, I wanted to report it, but I checked the repo again before sending the issue and it is not there anymore. Could you check if your repository was deleted as well? Maybe it was just slow