-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
Module
Core
Testcontainers version
1.19.7
Using the latest Testcontainers version?
Yes
Host OS
Linux Debian/sid
Host Arch
amd64
Docker version
Client: Docker Engine - Community
Version: 26.0.0
API version: 1.45
Go version: go1.21.8
Git commit: 2ae903e
Built: Wed Mar 20 15:18:01 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 26.0.0
API version: 1.45 (minimum version 1.24)
Go version: go1.21.8
Git commit: 8b79278
Built: Wed Mar 20 15:18:01 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.28
GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
rootlesskit:
Version: 2.0.2
ApiVersion: 1.1.1
NetworkDriver: slirp4netns
PortDriver: builtin
StateDir: /run/user/1000/dockerd-rootless
slirp4netns:
Version: 1.2.1
GitCommit: 09e31e92fa3d2a1d3ca261adaeb012c8d75a8194What happened?
I have a docker compose file which contains a variable substitution (${VAR}). A DockerComposeContainer is created to use the compose file and set the variable a withEnv-call. This works fine, but as soon the stop is called, an Exception is thrown due to an error (IllegalStateException: Container did not start correctly.).
version: "3.9"
services:
mock:
image: wiremock/wiremock:3.0.3-1
hostname: mock
db:
image: postgres:16
hostname: db
networks:
default:
external:
name: ${NETWORK}Network containerNetwork = Network.newNetwork()
DockerComposeContainer composeContainer = new DockerComposeContainer("compose-file.yaml")
.withExposedService("mock", 8080)
.withExposedService("db", 5432)
.withEnv("NETWORK", containerNetwork.getId());
composeContainer.start();
// .... everything fine until now
// the following stop will raise the excpeption, because inside of DockerComposeContainer#stop the env is not passed to the composeDelegate
composeContainer.stop();Relevant log output
Caused by: org.testcontainers.containers.ContainerLaunchException: Container startup failed for image docker/compose:1.29.2
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:359)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:330)
at org.testcontainers.containers.ContainerisedDockerCompose.invoke(ContainerisedDockerCompose.java:64)
at org.testcontainers.containers.ComposeDelegate.runWithCompose(ComposeDelegate.java:254)
at org.testcontainers.containers.ComposeDelegate.runWithCompose(ComposeDelegate.java:240)
at org.testcontainers.containers.DockerComposeContainer.stop(DockerComposeContainer.java:175)
at my.custom.DockerComposeResource.stop(DockerComposeResource.java:142)
at io.quarkus.test.common.TestResourceManager.close(TestResourceManager.java:177)
... 49 more
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:344)
... 56 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:563)
at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:354)
at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
... 57 more
Caused by: java.lang.IllegalStateException: Container did not start correctly.
at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:495)
... 59 moreAdditional Information
I have a fix prepared and will open a PR.