Skip to content

Using Jib

Jib is a library for building Docker images. You can use it as an alternative to Testcontainers default DockerfileBuilder.

GenericContainer<?> busybox = new GenericContainer<>(
    new JibImage(
        "busybox:1.35",
        jibContainerBuilder -> {
            return jibContainerBuilder.setEntrypoint("echo", "Hello World");
        }
    )
)
    .withStartupCheckStrategy(new OneShotStartupCheckStrategy().withTimeout(Duration.ofSeconds(3)))

Hint

The Testcontainers library JAR will not automatically add a jib-core JAR to your project. Minimum version required is com.google.cloud.tools:jib-core:0.22.0.