Skip to content

unknown flag: --env-file with docker compose v2 when using withEnvironmentFile function #480

@viswanr

Description

@viswanr

Expected Behaviour
The DockerComposeEnvironment is successfully created

Actual Behaviour
Errors out with:
unknown flag: --env-file
See 'docker --help'.

Usage:  docker [OPTIONS] COMMAND

Steps to Reproduce

  1. Install Docker Desktop on Windows with WSL enabled and Docker Compose V2 enabled.

The following code fails:

// Setup docker compose environment
    const env = new DockerComposeEnvironment(
      ".",
      "docker-compose.yml"
    ).withBuild();
    if (envFile && envFile.length > 0) {
      env.withEnvironmentFile(envFile);
    }

    // Starting services within container
    this.sandbox = await env.up(this.functionAppServices);

Environment Information

  • Operating System: Windows
  • Docker Version: Docker Desktop 4.16.3 (96739), Docker Engine v20.10.22
  • Node version: v16.19.0
  • Testcontainers version: "^9.1.3"

Looks like there is some ordering problem of arguments to docker with compose v2?

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