testcontainers / testcontainers/testcontainers-java
[Enhancement]: Allow varying the OS credential key and the registry name independently
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
Module
Core
Proposal
Within my corporate network, we use an internal image repository. Federated authentication of some form is active, after which the Windows Credential store contains a key/val pair, keyed on "https://index.docker.io/v1/". A problem arises when I attempt to resolve an internal image - the method org.testcontainers.utility.RegistryAuthLocator#effectiveRegistryName assumes that where a registry name is present in the DockerImageName (for arguments sake, corporate-image-repo.corp.com), this should be used as the lookup key in the credential store -
Windows Cred Store - "https://index.docker.io/v1/" : some-auth-token
final String registry = dockerImageName.getRegistry();
if (!StringUtils.isEmpty(registry)) {
//corporate-image-repo.corp.com <- lookup fails
return registry;
}
//lookup would succeed...
return StringUtils.defaultString(
DockerClientFactory.instance().getInfo().getIndexServerAddress(),
DEFAULT_REGISTRY_NAME
);
}
This results in being unable to resolve the access token from the Windows Credential store, and thus fails to pull the image from our internal repo.
I'm unsure whether this is a quirk of how our corporate federated login works, but it would be ideal to either :
- Allow override of the entire RegistryAuthLocator implementation so I can sub-class it (via testcontainers.properties) for example
- Add a field to DockerImageName allowing specification of the lookup key independent of the registry host
- Provide an option to force the default registry name for Credential store lookups
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with RegistryAuthLocator#effectiveRegistryName and DockerImageName, then trace how the Windows Credential store lookup uses the registry value. Compare the proposed override, independent lookup key, and forced default-name options; the work is complete when an internal image can resolve credentials using a key distinct from its registry host.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java
- Domain
- authentication, devops
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100