-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
core/src/test/java/org/testcontainers/junit/DockerComposeV2Test.java
Outdated
Show resolved
Hide resolved
core/src/test/java/org/testcontainers/junit/DockerComposeV2Test.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/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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
@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 compose
commands. It will be available usingComposeContainer
ComposeContainer
behaves similar toDockerComposeContainer
with 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 classComposeDelegate
which can be used in the future for new version ofComposeContainer
instead of adding more branches to the existingDockerComposeContainer
.