This file contains 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
#!/bin/bash | |
# This script remove tags from local registry, keeping just the n most recents tags | |
# | |
# based on: https://gist.github.com/jaytaylor/86d5efaddda926a25fa68c263830dac1?permalink_comment_id=4732942#gistcomment-4732942 | |
# and on: https://stackoverflow.com/questions/31251356/how-to-get-a-list-of-images-on-docker-registry-v2 | |
# Abels changes: | |
# - Not using jq utility, just curl and native linux binaries | |
# - Check based tag count, removing last n versions | |
# Sean's changes: | |
# - Add timestamp option - only delete tags earlier than the timestamp |