Last active
August 16, 2024 13:50
-
-
Save marjamis/fe812a8657b714efb48b16204801d9cf to your computer and use it in GitHub Desktop.
Sample curl commands for accessing registries
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
export DOCKER_REGISTRY_USERNAME="marjamis" | |
export REPOSITORY="test" | |
# Note: If using the base64 command doesn't work here you can run a docker login with your credentials and then copy the base64 value from the file: ~/.docker/config.json | |
export TOKEN=$(curl -H "Authorization: Basic <base64 of docker hub username:password>" "https://auth.docker.io/token?service=registry.docker.io&scope=repository:$DOCKER_REGISTRY_USERNAME/$REPOSITORY:pull,push" | jq .) | |
# Get the manifest of a specific image | |
curl -LH "Authorization: Bearer $TOKEN" https://index.docker.io/v2/$DOCKER_REGISTRY_USERNAME/$REPOSITORY/manifests/<tag or digest> | jq . | |
# Get a list of tags for images in this repository | |
curl -LH "Authorization: Bearer <token from above curl response>" https://index.docker.io/v2/$DOCKER_REGISTRY_USERNAME/$REPOSITORY/tags/list?n=30 | jq . |
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
export REGION=us-west-2 | |
export ACCOUNT_ID=<accountId> | |
export ECR_REGISTRY_URL="$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com" | |
export REPOSITORY="test" | |
export TOKEN=$(aws --region $REGION ecr get-authorization-token --output text --query authorizationData[].authorizationToken) | |
# Get the manifest of a specific image | |
curl -H "Authorization: Basic $TOKEN" https://$ECR_REGISTRY_URL/v2/$REPOSITORY/manifests/<tag or digest> | |
# Get a list of tags for images in this repository | |
curl -H "Authorization: Basic $TOKEN" https://$ECR_REGISTRY_URL/v2/$REPOSITORY/tags/list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment