-
-
Notifications
You must be signed in to change notification settings - Fork 588
fix: docker auth for docker.io images #3482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: docker auth for docker.io images #3482
Conversation
✅ Deploy Preview for testcontainers-go ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Summary by CodeRabbit
WalkthroughThe Docker image auth resolver now normalizes docker.io and registry.hub.docker.com to the configured default registry before credential lookup. A new unit sub-test verifies that DockerImageAuth returns the default registry's credentials for an image hosted at docker.io. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant AuthLayer as Auth Resolver
participant CredStore as Credential Store
rect rgb(245,250,255)
Client->>AuthLayer: Request auth for "docker.io/my/image:latest"
note right of AuthLayer: Normalize host aliases to default registry
AuthLayer->>AuthLayer: if host in {"docker.io","registry.hub.docker.com"} then host = defaultRegistry()
end
AuthLayer->>CredStore: Lookup credentials for remapped host
CredStore-->>AuthLayer: Credentials (username, password, auth)
AuthLayer-->>Client: Return registry, username, password, encoded Auth
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
bf4458c to
df49f93
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docker_auth.go(1 hunks)docker_auth_test.go(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- docker_auth_test.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (20)
- GitHub Check: lint (modules/dynamodb) / lint: modules/dynamodb
- GitHub Check: lint (modulegen) / lint: modulegen
- GitHub Check: lint (modules/dind) / lint: modules/dind
- GitHub Check: lint (modules/registry) / lint: modules/registry
- GitHub Check: lint (modules/dockermodelrunner) / lint: modules/dockermodelrunner
- GitHub Check: lint (modules/postgres) / lint: modules/postgres
- GitHub Check: lint (modules/qdrant) / lint: modules/qdrant
- GitHub Check: lint (modules/pinecone) / lint: modules/pinecone
- GitHub Check: lint (modules/redpanda) / lint: modules/redpanda
- GitHub Check: lint (modules/solace) / lint: modules/solace
- GitHub Check: lint (modules/memcached) / lint: modules/memcached
- GitHub Check: lint (modules/openfga) / lint: modules/openfga
- GitHub Check: lint (modules/pulsar) / lint: modules/pulsar
- GitHub Check: lint (modules/artemis) / lint: modules/artemis
- GitHub Check: lint (modules/influxdb) / lint: modules/influxdb
- GitHub Check: lint (modules/rabbitmq) / lint: modules/rabbitmq
- GitHub Check: lint (modules/dolt) / lint: modules/dolt
- GitHub Check: lint (modules/mariadb) / lint: modules/mariadb
- GitHub Check: lint (modules/consul) / lint: modules/consul
- GitHub Check: Analyze (go)
df49f93 to
00cbc7d
Compare
| // Make comparison case-insensitive and handle both aliases | ||
| if strings.EqualFold(reg, "docker.io") || strings.EqualFold(reg, "registry.hub.docker.com") { | ||
| reg = defaultRegistry | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: should this be handled by core.ExtractRegistry?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could. Up to y'all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should live there, @mdelapenya thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's move it there, and once we use the go-sdk, it will be resolved and easier to replace
What does this PR do?
When doing a Docker pull on an image with the default registry
docker.io, the auth helper doesn't match the image to the authentication data stored by the engine underhttps://index.docker.io/v1causing the error:credentials not found in native keychainWhy is it important?
This is important to support the default registry prefix.
How to test this PR
Unit test added