Skip to content

Instantly share code, notes, and snippets.

@jriguera
Last active April 12, 2017 11:53
Show Gist options
  • Select an option

  • Save jriguera/4bd5140a6aecb902a09a3f0fec2b4455 to your computer and use it in GitHub Desktop.

Select an option

Save jriguera/4bd5140a6aecb902a09a3f0fec2b4455 to your computer and use it in GitHub Desktop.

Revisions

  1. jriguera revised this gist Apr 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion list-dockerhub-images.sh
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,4 @@ set -e
    TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${UNAME}'", "password": "'${UPASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)

    # get list of repositories ordered by last_updated
    curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORG}/?page_size=200 | jq '.results|sort_by(.last_updated)|.[]|.namespace + "/" + .name + " updated=" + .l$
    curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORG}/?page_size=200 | jq '.results|sort_by(.last_updated)|.[]|.namespace + "/" + .name + " updated=" + .last_updated'
  2. jriguera revised this gist Apr 4, 2017. No changes.
  3. jriguera created this gist Apr 4, 2017.
    21 changes: 21 additions & 0 deletions list-dockerhub-images.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/bin/bash
    # Based on kizbitz/dockerhub-v2-api-organization.sh at https://gist.github.com/kizbitz/175be06d0fbbb39bc9bfa6c0cb0d4721

    # Example for the Docker Hub V2 API
    # Returns all images and tags associated with a Docker Hub organization account.
    # Requires 'jq': https://stedolan.github.io/jq/

    # set username, password, and organization
    UNAME=""
    UPASS=""
    ORG=""

    # -------

    set -e

    # get token
    TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${UNAME}'", "password": "'${UPASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)

    # get list of repositories ordered by last_updated
    curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/${ORG}/?page_size=200 | jq '.results|sort_by(.last_updated)|.[]|.namespace + "/" + .name + " updated=" + .l$