Created
November 22, 2018 10:52
-
-
Save chris-brown/4014d26259c6faf2568eed5ce679caf2 to your computer and use it in GitHub Desktop.
Deletes all docker images for given repository
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 characters
registry='https://docker-registry.laterooms.io:5000' | |
names='tlrg/logstash-hra-pipe' | |
for name in ${names}; do for n in $( | |
for p in $(curl -sSL "${registry}/v2/${name}/tags/list" | jq -r '.tags[]'); do | |
curl -sSL -I \ | |
-H "Accept: application/vnd.docker.distribution.manifest.v2+json" \ | |
"${registry}/v2/${name}/manifests/${p}" \ | |
| awk '$1 == "docker-content-digest:" { print $2 }' \ | |
| tr -d $'\r' | |
done); do | |
echo curl -v -sSL -X DELETE "${registry}/v2/${name}/manifests/${n}" | |
done | |
done |
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 characters
docker exec registry bin/registry garbage-collect --dry-run /etc/docker/registry/config.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment