Skip to content

Instantly share code, notes, and snippets.

@dariuszparys
Created May 7, 2024 18:54
Show Gist options
  • Save dariuszparys/713c21588e8393af9f7d1286dcaa1bb8 to your computer and use it in GitHub Desktop.
Save dariuszparys/713c21588e8393af9f7d1286dcaa1bb8 to your computer and use it in GitHub Desktop.
Docker Rate Limit Azure Pipeline
trigger: none
pool:
vmImage: ubuntu-latest
steps:
- script: |
docker images
displayName: "List available images in agent"
- script: |
TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
echo "##vso[task.setvariable variable=TOKEN]$TOKEN"
displayName: "Get anonymous token"
- script: |
cargo install jwt-cli
jwt decode $TOKEN
displayName: "Decode JWT Token"
env:
TOKEN: $(TOKEN)
- script: |
curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest
displayName: "Check rate limit"
env:
TOKEN: $(TOKEN)
- script: |
docker pull python:latest
docker pull python:bullseye
docker pull python:bookworm
docker pull python:3.9.19-bullseye
docker pull python:3.9.19-bookworm
docker pull python:3.8
docker pull python:3.13-rc
docker pull python:3.12
docker pull python:3.11-slim-buster
docker pull python:3.12-slim
displayName: "Pulling 10 images"
- script: |
curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest
displayName: "Check rate limit"
env:
TOKEN: $(TOKEN)
- script: |
jwt decode $TOKEN
displayName: "Decode JWT Token"
env:
TOKEN: $(TOKEN)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment