| #D Displays information about Docker images in the CORD POD registry |
| PROG=$(echo $(basename $0) | sed -e 's/^cord-/cord /g') |
| echo "usage: $PROG [-r|--registry <registry] <sub-command> [options]" |
| echo " list display the Docker images in the registry" |
| echo " help this message" |
| echo "usage $PROG list [--json|-j]" |
| echo " json display output as JSON object" |
| echo " help this message" |
| echo "Unknown option '$1'" |
| >&2 echo "Unknown option '$1'" |
| if [ $DO_JSON -eq 1 ]; then |
| /bin/echo -n '{"registries":[' |
| for i in $(curl -sSL http://$REG/v2/_catalog | jq '.repositories | .[]' | sed -e 's/"//g'); do |
| /bin/echo -n "$COMMA{\"registry\":\"${REG}/$i\",\"tags\":[" |
| for t in $(curl -sSL http://$REG/v2/$i/tags/list | jq '.tags | .[]' | sed -e 's/"//g'); do |
| echo "REPOSITORY,TAG" > $OUT |
| for i in $(curl -sSL http://$REG/v2/_catalog | jq '.repositories | .[]' | sed -e 's/"//g'); do |
| for t in $(curl -sSL http://$REG/v2/$i/tags/list | jq '.tags + [] | .[]' | sed -e 's/"//g'); do |
| /bin/echo -e "${REG}/$i,$t" >> $OUT |
| cat $OUT | column -s , -t |