Created
August 24, 2021 09:41
-
-
Save ajorpheus/fb33faeda49ce58284920243ac3add7f to your computer and use it in GitHub Desktop.
Create a repository on Docker Hub from CLI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
export USER="johndoe" | |
export PASS="personal-access-token" | |
## Get the JWT token | |
TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${USER}'", "password": "'${PASS}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token) | |
## API call to create repo | |
curl -s -H "Authorization: JWT ${TOKEN}" "https://hub.docker.com/v2/repositories/" --data 'description=test' --data 'full_description=full-description' --data 'is_private=true' --data 'name=test' --data "namespace=${USER}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment