Last active 1705433069

List & filter tags in docker hub with Skopeo and jq

find_tags.sh Raw
1#!/bin/bash
2
3if [[ "$#" -eq 0 ]]; then
4 echo "Usage: $0 IMAGE [INCLUDE] [EXCLUDE]
5 IMAGE The image to search
6 Examples: httpd, lousilam/uptime-kuma
7 INCLUDE Include results containing INCLUDE
8 Pass '' to only use EXCLUDE filtering
9 EXCLUDE Exclude results containing EXCLUDE
10"
11 exit 1
12fi
13
14image=$1
15filter=$2
16notfilter=${3:- }
17jqfilter=".RepoTags[] \
18| select(contains(\"$filter\")) \
19| select(contains(\"$notfilter\") | not)"
20
21skopeo inspect "docker://$image" \
22| jq -r "$jqfilter"