Add support for compose v2 with ComposeContainer#5608
Conversation
[Compose V2](https://www.docker.com/blog/announcing-compose-v2-general-availability/) offers arm images to perform `docker compose` commands. It should be enabled ```java public static DockerComposeContainer environment = new DockerComposeContainer(new File("src/test/resources/compose-test.yml")) .withComposeV2() .withExposedService("redis-1", REDIS_PORT, Wait.forListeningPort()) .waitingFor("db-1", Wait.forLogMessage("started", 1)); ```
|
|
|
following @kiview suggestion. pr has been updated to opt-in for compose v2 via config property |
kiview
left a comment
There was a problem hiding this comment.
Looks generally fine, just a couple of minor remarks. Did you already try it with a local compose?
core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Kevin Wittek <kiview@users.noreply.github.com>
core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/testcontainers/containers/DockerComposeOverridesTest.java
Outdated
Show resolved
Hide resolved
|
Hi @kiview ! Is there any news on this PR here? Is there any way to get this PR merged soon? :) |
|
following option did worked for me, using
rieckpil/testing-spring-boot-applications-masterclass#305 (comment) |
kiview
left a comment
There was a problem hiding this comment.
Let's update the PR description with the reasons behind the design decision to introduce a new class for Docker Compose V2 and hence have users explicitly switch to using V2 through this 👍
core/src/main/java/org/testcontainers/containers/ComposeContainer.java
Outdated
Show resolved
Hide resolved
| ```java | ||
| public static ComposeContainer environment = | ||
| new ComposeContainer(new File("src/test/resources/compose-test.yml")) | ||
| .withExposedService("redis-1", REDIS_PORT, Wait.forListeningPort()) |
There was a problem hiding this comment.
We need an explicit note, that users need to be aware of using - instead of _ for V2 services in their code.
…ner.java Co-authored-by: Kevin Wittek <kiview@users.noreply.github.com>
|
@eddumelendez what is the schedule for the next release?
|
|
Also interested in the ETA on the next release as we'd love to have this fix available in a published version. |
|
Hi @eddumelendez . Are there any news for the ETA on the next release? |
Compose V2 offers arm images to perform
docker composecommands. It will be available usingComposeContainerComposeContainerbehaves similar toDockerComposeContainerwith just one hint, service names should use-rather than_.Why a new class?
During development we were evaluating different approaches such as introducing a new flag to opt-in to
v2. However, we decided to move most of the config to an internal classComposeDelegatewhich can be used in the future for new version ofComposeContainerinstead of adding more branches to the existingDockerComposeContainer.