testcontainers-node icon indicating copy to clipboard operation
testcontainers-node copied to clipboard

Feature Request: Add standalone Option to DockerComposeClient in DockerComposeEnvironment

Open Dyskal opened this issue 7 months ago • 1 comments

Is your feature request related to a problem? Please describe.

My team utilizes docker-compose as a standalone binary, and we currently lack a mechanism to pass the standalone option through the DockerComposeClient when using DockerComposeEnvironment. This limits our ability to leverage Testcontainers-Node with our existing docker-compose setup.

The standalone flag is documented in the underlying docker-compose library's README: https://github.com/PDMLab/docker-compose?tab=readme-ov-file#standalone-mode.

Describe the solution you'd like

I would like to see an option added to DockerComposeClient (and consequently accessible via DockerComposeEnvironment) that allows users to specify the standalone flag for the docker-compose executable.

Ideally, this could be achieved by extending the ComposeOptions interface to include an executable property, similar to how it's handled in the PDMLab/docker-compose library:

interface ComposeOptions{
  // ... existing options
  executable?: {
    standalone?: boolean;
    executablePath?: string;
  };
}

This would allow users to configure DockerComposeEnvironment like so:

const environment = new DockerComposeEnvironment(
  path.resolve(__dirname, './compose-files'),
  'docker-compose.yml'
);

environment.withClientOptions({
  executable: {
    standalone: true,
    executablePath: '/usr/local/bin/docker-compose', // Example custom path
  },
});

await environment.up();

Describe alternatives you've considered

Currently, we are constrained to keep using Testcontainers-Node v10, as v11 updates the underlying library docker-compose from v0 to v1, which removed the support of docker compose version 1 and standalone binary out of the box.

Additional context

This feature would significantly improve the flexibility and usability of Testcontainers-Node for teams that rely on standalone docker-compose installations. It would enable seamless integration and allow us to leverage the benefits of Testcontainers for managing our testing infrastructure.

Dyskal avatar Jun 11 '25 14:06 Dyskal

Makes sense! PR welcome

cristianrgreco avatar Jun 11 '25 14:06 cristianrgreco