Skip to content
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

[Enhancement]: Allow varying the OS credential key and the registry name independently #9573

Open
alfa-f opened this issue Nov 27, 2024 · 0 comments

Comments

@alfa-f
Copy link

alfa-f commented Nov 27, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant