GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add support for compose v2 with ComposeContainer by eddumelendez · Pull Request #5608 · testcontainers/testcontainers-java

Conversation

@eddumelendez

@eddumelendez eddumelendez commented Jul 24, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Compose V2 offers arm images to perform docker compose commands. It will be available using ComposeContainer

public static ComposeContainer environment =
    new ComposeContainer(new File("src/test/resources/compose-test.yml"))
            .withExposedService("redis-1", REDIS_PORT, Wait.forListeningPort())
            .waitingFor("db-1", Wait.forLogMessage("started", 1));

ComposeContainer behaves similar to DockerComposeContainer 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 class ComposeDelegate which can be used in the future for new version of ComposeContainer instead of adding more branches to the existing DockerComposeContainer.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sebastianhaberey, sergeykad, sergei-ivanov, ismailsimsek, bdellegrazie, emeraldhieu, suguiura-pp, and sergey-morenets reacted with thumbs up emoji
All reactions
  • 👍 8 reactions
@eddumelendez
Add support for compose v2
8573b7e
[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));
```
@eddumelendez
eddumelendez requested a review from a team July 24, 2022 05:09
@github-actions github-actions Bot added the type/docs label Jul 24, 2022
@eddumelendez

eddumelendez commented Jul 24, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

withComposeV2() should be called before .withExposedService("redis-1", REDIS_PORT, Wait.forListeningPort()) otherwise the name generated will contain underscores instead of hyphens. I was thinking on adding new constructors instead of withComposeV2()

new DockerComposeContainer(Compose.V2, new File("src/test/resources/compose-test.yml"))
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@eddumelendez eddumelendez added the area/docker-compose label Jul 24, 2022
@eddumelendez eddumelendez assigned eddumelendez and kiview Jul 26, 2022
eddumelendez added 2 commits July 28, 2022 14:44
@eddumelendez
Add configuration property to enable compose v2 compatibility
9f3983b
@eddumelendez
Add docs
2f4c569
@eddumelendez

eddumelendez commented Jul 28, 2022

Copy link
Copy Markdown
Member Author

following @kiview suggestion. pr has been updated to opt-in for compose v2 via config property

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

eddumelendez added 2 commits July 28, 2022 17:18
@eddumelendez
Fix tests
cb139d5
@eddumelendez
Fix assumption
69dbf78
kiview
kiview requested changes Jul 29, 2022
View reviewed changes

@kiview kiview left a comment

Copy link
Copy Markdown
Member

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?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/features/configuration.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/modules/docker_compose.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/modules/docker_compose.md Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread core/src/test/java/org/testcontainers/junit/DockerComposeV2Test.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread core/src/test/java/org/testcontainers/junit/DockerComposeV2Test.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

eddumelendez and others added 4 commits July 29, 2022 15:15
@eddumelendez @kiview
Update docs/modules/docker_compose.md
7f9e995
Co-authored-by: Kevin Wittek <[email protected]>
@eddumelendez
Autodetect compose v2
48b15a9
@eddumelendez
Add testcontainers prefix to config property
2cdfb5c
@eddumelendez
Merge branch 'master' into composev2
deb5f2b
@eddumelendez
eddumelendez requested a review from kiview July 29, 2022 21:27
@eddumelendez
Fix test
afbc537
@eddumelendez
eddumelendez force-pushed the composev2 branch from 8b8ffb8 to afbc537 Compare July 29, 2022 23:44
@eddumelendez
Fix test
01f28f8
@eddumelendez eddumelendez added this to the next milestone Jul 30, 2022
bsideup
bsideup reviewed Aug 2, 2022
View reviewed changes
Comment thread core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

bsideup
bsideup reviewed Aug 2, 2022
View reviewed changes
Comment thread core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

bsideup
bsideup reviewed Aug 2, 2022
View reviewed changes
Comment thread core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@eddumelendez
Fix comments
e8e07c5
@eddumelendez eddumelendez mentioned this pull request Aug 3, 2022
LocalDockerCompose does not support Docker Compose v2 #5596
Closed
bsideup
bsideup reviewed Aug 4, 2022
View reviewed changes
Comment thread core/src/main/java/org/testcontainers/containers/DockerComposeContainer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

bsideup
bsideup reviewed Aug 4, 2022
View reviewed changes
Comment thread core/src/main/java/org/testcontainers/utility/TestcontainersConfiguration.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

bsideup
bsideup reviewed Aug 4, 2022
View reviewed changes
Comment thread core/src/test/java/org/testcontainers/containers/DockerComposeOverridesTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@eddumelendez eddumelendez mentioned this pull request Apr 29, 2023
Remove link usage in DockerComposeContainer #6946
Closed
eddumelendez added 2 commits April 29, 2023 08:46
@eddumelendez
Merge branch 'main' into composev2
196d180
@eddumelendez
Drop link in favor of networks
337e0c7
@Waize

Waize commented May 2, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Hi @kiview !

Is there any news on this PR here?
According to the docker docs, the compose V1 will be removed in June 2023 from all Docker Desktop versions: https://docs.docker.com/compose/compose-v2/.
That could mean, that any Windows user can not use Testcontainers anymore, am I right?

Is there any way to get this PR merged soon? :)

ismailsimsek, probeonstimpack, Allsimon, apappascs, and emeraldhieu reacted with thumbs up emoji
All reactions
  • 👍 5 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ismailsimsek

ismailsimsek commented May 3, 2023

Copy link
Copy Markdown

following option did worked for me, using .withOptions("--compatibility")

Are you using the latest state on the main branch? I've added there .withOptions("--compatibility") to the AbstractWebTest class and the DockerCompose setup, which #4565.

rieckpil/testing-spring-boot-applications-masterclass#305 (comment)

PiotrMarcinczyk-TomTom reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

eddumelendez added 5 commits May 9, 2023 22:14
@eddumelendez
Merge branch 'main' into composev2
601148e
@eddumelendez
Add test for identifier in uppercase
0840644
@eddumelendez
Revert "Drop link in favor of networks"
6a39b89
This reverts commit 337e0c7.
@eddumelendez
Merge branch 'main' into composev2
c2dcc88
@eddumelendez
Fix test
39b37d7
kiview
kiview previously approved these changes May 26, 2023
View reviewed changes

@kiview kiview left a comment

Copy link
Copy Markdown
Member

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 👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread core/src/main/java/org/testcontainers/containers/ComposeContainer.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread docs/modules/docker_compose.md
```java
public static ComposeContainer environment =
new ComposeContainer(new File("src/test/resources/compose-test.yml"))
.withExposedService("redis-1", REDIS_PORT, Wait.forListeningPort())

@kiview kiview May 26, 2023

Copy link
Copy Markdown
Member

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@eddumelendez eddumelendez added this to the next milestone Jun 20, 2023
@eddumelendez @kiview
Update core/src/main/java/org/testcontainers/containers/ComposeContai…
a078382
…ner.java

Co-authored-by: Kevin Wittek <[email protected]>
@eddumelendez
eddumelendez dismissed kiview’s stale review via a078382 June 20, 2023 21:30
eddumelendez added 4 commits June 20, 2023 15:30
@eddumelendez
Merge branch 'main' into composev2
4c7ca00
@eddumelendez
Add note
9317f81
@eddumelendez
Update docker version
3e21972
@eddumelendez
Update labeler.yml
7e2f2da
@eddumelendez
eddumelendez merged commit 7112db5 into main Jun 21, 2023
@eddumelendez
eddumelendez deleted the composev2 branch June 21, 2023 03:24
This was referenced Jun 21, 2023
DockerComposeContainer does not work with local docker-compose v2 #4565
Closed
[Bug]: docker/compose:1.29.2 image is amd64 and requires QEMU emulator to work on Arm #5524
Closed
@pan3793

pan3793 commented Jul 6, 2023

Copy link
Copy Markdown
Contributor

@eddumelendez what is the schedule for the next release?

From July 2023 Compose V1 stopped receiving updates. It’s also no longer available in new releases of Docker Desktop.

https://docs.docker.com/compose/migrate/

PandarinDev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@PandarinDev

PandarinDev commented Jul 6, 2023

Copy link
Copy Markdown

Also interested in the ETA on the next release as we'd love to have this fix available in a published version.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Waize

Waize commented Jul 24, 2023

Copy link
Copy Markdown

Hi @eddumelendez . Are there any news for the ETA on the next release?

sergeykad, andrelelis-ff, raipc, anselvo, rickcole3, eduramiba, pgharron, pedromnl, carlosmmesa, and frevib reacted with eyes emoji
All reactions
  • 👀 10 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jacomago jacomago mentioned this pull request Aug 21, 2023
Adds testing to the github ci ChannelFinder/ChannelFinderService#88
Merged
This was referenced Aug 24, 2023
ContainerLaunchException with Docker Compose V2 testcontainers/testcontainers-scala#200
Closed
Migrate to Docker Compose v2 testcontainers/testcontainers-scala#260
Merged
@jackyyyyyssss jackyyyyyssss mentioned this pull request Dec 15, 2023
[Improvement][E2E] support e2e compose v2 fix code style apache/dolphinscheduler#15325
Merged
@kiview kiview mentioned this pull request Dec 21, 2023
chore: update docker compose image #7989
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kiview kiview kiview left review comments
@bsideup bsideup Awaiting requested review from bsideup

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@eddumelendez eddumelendez

@kiview kiview

Labels

area/docker-compose type/docs

Projects

None yet

Milestone

1.19.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@eddumelendez @kiview @pan3793 @Waize @ismailsimsek @PandarinDev @bsideup
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.