Scr*_*Dev 2 docker docker-compose testcontainers docker-desktop
I'm trying to use TestContainers to run JUnit tests.
However, I'm getting a InternalServerErrorException: Status 500: {"message":"Get https://registry-1.docker.io/v2/: Forbidden"} error.
Please note, that I am on a secure network.
I can replicate this by doing docker pull testcontainers/ryuk on the command line.
$ docker pull testcontainers/ryuk
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: Forbidden
Run Code Online (Sandbox Code Playgroud)
However, I need it to pull from our nexus service: https://nexus.company.com/18443.
Inside the docker-compose file, I'm already using the correct nexus image path. (Verified by manually starting it with docker-compose. However TestContainers also pulls in additional images which are outside the docker-compose file. It is these images that are causing the failure.
I'd be glad for either a Docker Desktop or TestContainers configuration change that would fix this for me.
Note: I've already tried adding the host URL for nexus to the Docker Engine JSON configuration on the dashboard, with no change to the resulting error when doing docker pull.
从版本开始,1.15.1Testcontainers 允许自动将前缀附加到所有 docker 镜像。如果您的私有注册表配置为 docker hub 镜像,此功能应该有助于解决上述问题。
引用文档:
然后,您可以配置 Testcontainers 将前缀registry.mycompany.com/mirror/应用于它尝试从 Docker Hub 提取的每个映像。这可以通过以下两种方式之一完成:
- 设置环境变量 TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX=registry.mycompany.com/mirror/
- 通过配置文件,在以下任一位置设置 hub.image.name.prefix:
- 用户主目录中的 ~/.testcontainers.properties 文件,或者
- 类路径上名为 testcontainers.properties 的文件
基本上设置与 docker-compose 文件中的图像相同的前缀。
如果由于某种原因您坚持使用旧版本,不推荐使用的解决方案是仅覆盖该ryuk.container.image属性。在这里阅读相关内容。
| 归档时间: |
|
| 查看次数: |
3006 次 |
| 最近记录: |