Quarkus Test, Postgres & Testcontainers

Yesterday I deleted all of my local Docker images and suddenly my setup with Quarkus and Testcontainers JDBC connection string (jdbc:tc:postgresql:latest:///test) didn't work anymore.

Caused by: org.flywaydb.core.internal.exception.FlywaySqlException: Unable to obtain connection from database: Acquisition timeout while waiting for new connection  
SQL State  : null  
Error Code : 0  
Message    : Acquisition timeout while waiting for new connection  
    at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:60)

It seems that pulling the underlying containers for Postgres and Testcontainers causes this issue because that pulling takes a while. So you could implement a QuarkusTestResourceLifecycleManager and adjust the time:

package com.pikodat.common;

import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;  
import org.testcontainers.containers.PostgreSQLContainer;  
import org.testcontainers.utility.DockerImageName;

import java.time.Duration;  
import java.util.Collections;  
import java.util.Map;

public class PostgresqlResource implements QuarkusTestResourceLifecycleManager {

    private final PostgreSQLContainer<?> postgres =
            new PostgreSQLContainer<>(

    public Map<String, String> start() {
        return Collections.emptyMap();

    public void stop() {


But some hours later I found an easier method. 🤦🏼‍♂️ Just add %test.quarkus.datasource.jdbc.acquisition-timeout=30 to your application.properties.