Manages Docker Hub credentials for the MockServer project. Guides the user through creating a Docker Hub Personal Access Token, validates it, and stores it in AWS Secrets Manager for use by CI pipelines. Use when the user says "docker hub credentials", "docker hub token", "set up docker push", "configure docker hub", "rotate docker token", or needs to store Docker Hub credentials in AWS Secrets Manager.
76
94%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
High
Do not use without reviewing
This skill guides you through creating (or rotating) Docker Hub credentials and storing
them in AWS Secrets Manager (mockserver-build/dockerhub) for use by Buildkite pipelines.
mockserver-build SSO profileaws sso login --profile mockserver-buildmockserver/mockserver repositoryaws_secretsmanager_secret.dockerhub resource
in terraform/buildkite-agents/build-secrets.tf must exist)Before asking the user to create a new token, check if Docker Hub credentials are already available locally:
# Check what credential store is configured
cat ~/.docker/config.json | python3 -c "import sys,json; print(json.load(sys.stdin).get('credsStore','none'))"
# Try to extract credentials (the helper name comes from credsStore above)
echo "https://index.docker.io/v1/" | docker-credential-desktop get 2>/dev/nullIf credentials are found, ask the user if they want to use them. Note that credentials from Docker Desktop may be session tokens rather than reusable PATs — prefer creating a dedicated PAT in Step 2 for production use.
If no local credentials are available (or the user wants a fresh token):
https://app.docker.com/settings/personal-access-tokensmockserver-ci (or similar)dckr_pat_...)Ask the user to provide:
Test the credentials before storing them:
echo "<token>" | docker login --username "<username>" --password-stdin 2>&1If login succeeds, proceed. If it fails, ask the user to verify the token.
After validation, log out to avoid leaving credentials in the local Docker config:
docker logoutaws secretsmanager put-secret-value \
--secret-id mockserver-build/dockerhub \
--secret-string '{"username":"<username>","token":"<token>"}' \
--profile mockserver-build \
--region eu-west-2IMPORTANT: Never log or echo the token value. Use the AWS CLI directly.
Confirm the secret was stored correctly by checking the JSON structure (not the token value):
aws secretsmanager get-secret-value \
--secret-id mockserver-build/dockerhub \
--profile mockserver-build \
--region eu-west-2 \
--query 'SecretString' \
--output text | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'✓ Secret contains username: {\"username\" in d}'); print(f'✓ Secret contains token: {\"token\" in d}'); print(f'✓ Username: {d.get(\"username\", \"MISSING\")}'); print(f'✓ Token length: {len(d.get(\"token\", \"\"))} chars')"SECURITY: Never print any part of the token value (not even the first N characters). Verify by checking the JSON structure and token length only.
| Problem | Cause | Fix |
|---|---|---|
aws secretsmanager put-secret-value fails with "not found" | Terraform not applied | Run terraform apply in terraform/buildkite-agents/ |
docker login fails with 401 | Token expired or invalid | Create a new PAT in Docker Hub |
| AWS CLI fails with expired SSO token | SSO session expired | Run aws sso login --profile mockserver-build |
ResourceNotFoundException | Secret doesn't exist yet | Ensure terraform apply has been run for build-secrets.tf |
buildkite-read-dockerhub-secret IAM policy)817ee95
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.