Skip to content

Instantly share code, notes, and snippets.

@atomlab
Created December 14, 2020 14:09
Show Gist options
  • Save atomlab/8b8fdebc0d97a3af4a41a8bbf02b258a to your computer and use it in GitHub Desktop.
Save atomlab/8b8fdebc0d97a3af4a41a8bbf02b258a to your computer and use it in GitHub Desktop.
Create a private repository on Docker Hub using Docker Registry API Client

Api Documentation

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)

curl -s -H "Authorization: JWT ${TOKEN}" "https://hub.docker.com/v2/repositories/" \
     --data 'description=test' \
     --data 'full_description=full-description' \
     --data 'is_private=false' \
     --data 'name=test' \
     --data "namespace=${UNAME}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment