Skip to content

Instantly share code, notes, and snippets.

View seanslma's full-sized avatar

Sean seanslma

View GitHub Profile
#!/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