#!/bin/bash echo Delete image from register and push it again reg='dockreg:5000' image='mubu7' itag='v7' auth='-u alexander:sofianos' accept=( -H "Accept: application/vnd.docker.distribution.manifest.v2+json" ) echo Curl delete on the hash value - digest; read curl ${auth} -vsk \ -X DELETE \ "https://${reg}/v2/${image}/manifests/$( curl ${auth} \ -vk "${accept[@]}" \ https://${reg}/v2/${image}/manifests/${itag} 2>&1 |\ grep docker-content-digest | awk '{print $3}' |\ tr -d $'\r' )" echo Delete blobs; read kubectl exec -it dockreg-pod -- sh -c " bin/registry garbage-collect \ /etc/docker/registry/config.yml && \ rm -rf \ /var/lib/registry/docker/registry/v2/repositories/${image} && \ echo; echo ls repositories; read ls /var/lib/registry/docker/registry/v2/repositories " echo echo Push again the deleted image mubu7; read docker push ${reg}/${image}:${itag} echo echo Query repositories; read curl ${auth} -ik https://${reg}/v2/_catalog