Skip to content

Unexpected behaviour when running 2 docker compose in different paths #943

@dferendo

Description

@dferendo

Expected Behaviour

This works in command line, it runs the 2 compose files:

  try {
    execSync(
      'docker compose -f ../lib/rollup/docker/docker-compose.yml -f docker-compose.yml up -d',
      {
        cwd: path.resolve(PROJECT_ROOT, "docker"),
        stdio: 'inherit'
      }
    );
  } catch (error) {
    console.error("Docker compose failed:", error);
    throw error;
  }

Running it with the library using

  environment = await new DockerComposeEnvironment(
    dockerDir,
    ["../lib/rollup/docker/docker-compose.yml", "docker-compose.yml"]
  )
  .withBuild()
  .up();

gives the error open docker.ignition.Dockerfile: no such file or directory

Actual Behaviour

docker compose -f ../lib/rollup/docker/docker-compose.yml -f docker-compose.yml up

Library should follow the cli commands, but maybe i missed something

Testcontainer Logs

      at handleAndRethrow (node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/container-runtime/clients/compose/compose-client.ts:214:46)
      at ComposeV2Client.up (node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/container-runtime/clients/compose/compose-client.ts:136:13)
      at async DockerComposeEnvironment.up (node_modules/.pnpm/[email protected]/node_modules/testcontainers/src/docker-compose-environment/docker-compose-environment.ts:110:5)
      at async startEnvironment (e2e/util/containers.ts:37:17)
      at async Context.<anonymous> (e2e/util/testWithContainers.ts:9:5)

Steps to Reproduce
2 docker compose in different folders

Environment Information

  • Operating System: macos
  • Docker Version: 28.0.1
  • Node version: v22.14.0
  • Testcontainers version: 10.17.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageInvestigation required

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions