Umgebung:
- Betriebssystem: Windows 11
- Java: 21 (Corretto)
- Spring Boot: 3.4.1
- Testcontainer: 1.20.4
- Docker Desktop: Läuft (v4.37+)
Was ich bisher versucht habe:
- Docker-Konfiguration: „Daemon auf tcp://localhost:2375 ohne TLS verfügbar machen“ in den Docker Desktop-Einstellungen aktiviert.
- Umgebungsvariablen: DOCKER_HOST mit dem Wert tcp://localhost:2375 sowohl zu Benutzer- als auch zu Systemumgebungsvariablen in Windows hinzugefügt.
- Überprüfung: Netstat -an | ausgeführt findstr 2375 und bestätigt, dass der Port lauscht ().
Code: Select all
TCP 0.0.0.0:2375 ... LISTENING - Neustart: IntelliJ IDEA und den PC mehrmals neu gestartet.
- Konfigurationsdatei: Habe versucht, eine .testcontainers.properties-Datei im Benutzer-Home mit docker.host=tcp://localhost:2375 zu erstellen, aber das war nicht der Fall Arbeit.
Code: Select all
AbstractIntegrationTest.javaJava
Code: Select all
@ContextConfiguration(initializers = AbstractIntegrationTest.Initializer.class)
public class AbstractIntegrationTest {
static class Initializer implements ApplicationContextInitializer {
// Changed from postgres:18 to postgres:16-alpine just to be safe
static PostgreSQLContainer postgresSQL = new PostgreSQLContainer("postgres:16-alpine");
private static void startContainers() {
Startables.deepStart(Stream.of(postgresSQL)).join();
}
@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
startContainers();
// ... (property mapping logic)
}
}
}
Klartext
Code: Select all
java.lang.IllegalStateException: Could not find a valid Docker [url=viewtopic.php?t=25360]environment.[/url] Please check configuration. Attempted configurations were:
EnvironmentAndSystemPropertyClientProviderStrategy: failed with exception BadRequestException (Status 400: ...)
NpipeSocketClientProviderStrategy: failed with exception BadRequestException (Status 400: ...)
Weiß jemand, warum Testcontainer keine Verbindung zu Docker Desktop unter Windows herstellen können, selbst wenn DOCKER_HOST explizit festgelegt ist?
Mobile version