Skip to content
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

Setting COMPOSE_COMPATIBILITY flag changes behavior of separators and break Compose v2 integration #840

Open
obelix74 opened this issue Oct 2, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@obelix74
Copy link

obelix74 commented Oct 2, 2024

Expected Behaviour

The separators for docker container names when using docker compose should be uniform, either _ or -.

Actual Behaviour

Currently, testcontainers-node has no way to set --compatibility on the docker compose client. I have two environments, one in which docker-compose is installed and in one where docker-compose is not installed. In the environment where docker-compose is installed, an env variable COMPOSE_COMPATIBILITY is set. This changes the separators from - to _ for docker containers.

With Docker version 2.29.2-desktop.2, there is no way to access docker-compose (it seems to have been removed) and the only separator supported is -.

Testcontainer Logs
Attached two sets of logs.WithoutComposeComptability.txt
WithComposeCompatibility.txt

Steps to Reproduce
@kiview was able to reproduce this with COMPOSE_COMPATIBILITY turned on.

Environment Information

  • Operating System: Mac desktop and Linux
  • Docker Version: 2.29.2-desktop.2 on Mac. docker-compose version 1.28.2, build 67630359 and Docker Compose version v2.18.1 in Linux
  • Node version: 20.17.0
  • Testcontainers version: 10.13.1
@kiview kiview changed the title TestContainers using Docker Compose - setting COMPOSE_COMPATIBILITY flag changes behavior of separators Setting COMPOSE_COMPATIBILITY flag changes behavior of separators and break Compose v2 integration Oct 2, 2024
@kiview kiview added the bug Something isn't working label Oct 2, 2024
@obelix74
Copy link
Author

obelix74 commented Oct 2, 2024

A workaround is to set COMPOSE_COMPATIBILITY to false explicitly.

@kiview
Copy link
Member

kiview commented Oct 4, 2024

Thanks @obelix74 for getting involved in the debugging work in Slack.

I don't think we will add support for COMPOSE_COMPATIBILITY in any of the TC languages, but I wonder how we can provide a better DX around this situation still.

Some ideas:

  • Document that COMPOSE_COMPATIBILITY is not supported (this will likely lead to issues for other TC languages as well)
  • When using Compose v2 integration, check the value for COMPOSE_COMPATIBILITY and with clear error if set to true?

@obelix74
Copy link
Author

obelix74 commented Oct 4, 2024

One way to solve it might be to add an option that allows clients to enable --compatibility. The Java client seems to have .withOption("--compatibility"). This will force the usage of _ everywhere until docker compose version 1 is purged completely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants