gpt4 book ai didi

java - Testcontainers不使用本地docker镜像

转载 作者:行者123 更新时间:2023-12-02 08:40:33 26 4
gpt4 key购买 nike

我的互联网连接速度很慢,但我已经有了我需要的 docker 镜像。docker镜像ls:

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

因此,我尝试在具有指定版本(不是最新)的测试容器中使用它

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

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

或者使用通用的:

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

但是结果是错误的:

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

如何调整测试容器以使用本地镜像?

最佳答案

默认情况下,测试容器 uses the local cache ,但它也依赖于几个公共(public)图像 “to perform different actions like startup checks, VNC recording and others” ,包括使用 Ryuk 进行容器清理.

我认为在您的情况下,加载其中一些辅助图像可能会失败。尝试手动将它们拉入。我的赌注是 quay.io/testcontainers/ryuk:0.2.3,因为您不应该真正需要其余的。

关于java - Testcontainers不使用本地docker镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61415924/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com