Andrei Koch
Andrei Koch

Reputation: 1140

Testcontainers doesn't use local docker image

I have slow internet connection, but I already have docker image that I need. 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?

Upvotes: 1

Views: 3598

Answers (1)

sainaen
sainaen

Reputation: 1578

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.

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.

Upvotes: 1

Related Questions