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

未关闭
#9,573 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
30/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
docker, java

调研方向

从 RegistryAuthLocator#effectiveRegistryName 和 DockerImageName 开始,然后跟踪 Windows Credential store 查找如何使用 registry 值。比较 proposed override、独立查找键和强制默认名称这几个选项;当内部镜像能够使用不同于其 registry host 的键解析凭据时,工作即告完成。

由索引模型根据 Issue 内容生成。

描述

type/enhancement
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
主要语言
Java
星标
8.8k
派生
2k
平均合并
5 天 21 小时
30 天内合并 PR
15

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

testcontainers/testcontainers-java 的其他 Issue

查看 testcontainers/testcontainers-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。