简体   繁体   English

测试容器不使用本地 docker 映像

[英]Testcontainers doesn't use local docker image

I have slow internet connection, but I already have docker image that I need.我的互联网连接速度很慢,但我已经有了需要的 docker 图像。 docker image ls : docker image ls

yandex/clickhouse-server   20.1.8.41           3edfaacaf3ed        5 weeks ago         487MB

So, I am trying to use it in testcontainers with specified version (not latest )所以,我试图在具有指定版本的测试容器中使用它(不是最新的)

@Rule
public ClickHouseContainer clickHouseContainer = (ClickHouseContainer)new ClickHouseContainer("yandex/clickhouse-server:20.1.8.41");

@Test
public void test() {
    System.out.println(clickHouseContainer.getJdbcUrl());
}

or with generic one:或通用的:

public GenericContainer genericContainer = new GenericContainer("yandex/clickhouse-server:20.1.8.41");

But the result is error:但结果是错误:

Caused by: com.github.dockerjava.api.exception.DockerClientException: Could not pull image: net/http: TLS handshake timeout

How can I tune testcontainers to use local images?如何调整测试容器以使用本地图像?

By default, testcontainers uses the local cache , but it also relies on several public images “to perform different actions like startup checks, VNC recording and others” , including container cleanup with Ryuk .默认情况下,testcontainers 使用本地缓存,但它也依赖于几个公共镜像“执行启动检查、VNC 记录等不同操作” ,包括使用Ryuk清理容器。

I think the loading of some of these auxiliary images is what could be failing in your case.我认为加载其中一些辅助图像在您的情况下可能会失败。 Try pulling them in manually.尝试手动将它们拉入。 My bet is on quay.io/testcontainers/ryuk:0.2.3 , since you shouldn't really need the rest.我的赌注是quay.io/testcontainers/ryuk:0.2.3 ,因为你不应该真的需要 rest。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将本地 Docker 映像与 testcontainers 一起使用? - How to use local Docker image with testcontainers? 如何强制测试容器使用特定的 docker 图像? - How to force Testcontainers to use specific docker image? 在Testcontainers中使用自定义DB docker-image - Using custom DB docker-image with Testcontainers 测试容器:在测试容器内构建 docker 图像 - Testcontainers: build docker image inside testcontainer TestContainers 框架无法访问 docker deamon - TestContainers Framework can't reach docker deamon 测试容器的初始化脚本无法正常工作 - Init Script for Testcontainers doesn't work properly 在 testcontainers 中使用 PostgreSQLContainer 和图像 on-the-fly - Use PostgreSQLContainer with image on-the-fly in testcontainers Testcontainers,Docker in Docker with custom.network,容器不属于.network - Testcontainers, Docker in Docker with custom network, Containers don't belong to network 测试容器超时等待容器端口打开,使用 Elasticsearch docker 镜像 - Testcontainers timed out waiting for container port to open, with Elasticsearch docker image 使用 Jib 获取特定版本的图像(Maven、Docker、testcontainers) - Getting a specific version of an image with Jib (Maven, Docker, testcontainers)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM