testcontainers / testcontainers/testcontainers-java

Docker images are pulled by anonymous user rather then authenticated

Open
#4,912 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

resolution/waiting-for-info
Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

I have logged in with docker login -u <username> and base64 encrypted record was written to ~/.docker/config.json as:

"https://index.docker.io/v1/": {
	"auth": "<base64encoded username:password>"
}

However, when I use Testcontainers it pulls images as an anonymous user rather than authenticated.
Examined by pull ratelimit-remaining check:

[anonymous] TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
[authenticated] TOKEN=$(curl --user 'username:password' "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest

I see that anonymous user pull ratelimit-remaining decreases, however for an authenticated user, it stays the same.

The problem leads to reaching Docker pull rate limit much faster

Error during callback: com.github.dockerjava.api.exception.InternalServerErrorException: Status 500: {"message":"toomanyrequests: You have reached your pull rate limit

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the image pull through Testcontainers after running docker login and inspecting ~/.docker/config.json. Trace how Testcontainers obtains Docker credentials and compare its pull with the authenticated and anonymous rate-limit checks shown in the report. Done means authenticated credentials are used for pulls and the authenticated rate limit, rather than the anonymous limit, is consumed.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
devops, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.