ops/build/list_docker_images.sh

33 lines
789 B
Bash
Executable File

#!/bin/bash
usage() {
echo -n "Usage: ${0} <grep_filter>"
echo
exit 1
}
# --- Settings
RegistryService=cloud21.cvtt.vpn:5500
RegistryProtocol=http
print_all_reg_images() {
project=${1}
repositories=$(curl -s "${RegistryProtocol}://${RegistryService}/v2/_catalog" | jq -r '.repositories[]')
for repo in $repositories; do
# Fetch all tags for the repository
tags=$(curl -s "${RegistryProtocol}://${RegistryService}/v2/$repo/tags/list" | jq -r '.tags[]')
# List each tag
echo "REPO: $repo"
for tag in $tags; do
if [ "${project}" == "" ];then
echo "$repo:$tag"
else
echo "$repo:$tag" | grep ${project}
fi
done
done
}
print_all_reg_images ${1}