Skip to content

Compose container logs are only captured for successful starts #1210

@jalaziz

Description

@jalaziz

Expected Behaviour

When enabling log capture for docker compose, all containers logs should be capture regardless of the success of docker compose up

Actual Behaviour

Container logs are only captures if the compose stack successfully starts. This is related to #685.

Testcontainer Logs
...

Steps to Reproduce

  1. Enable container log capture: export DEBUG="testcontainers*"
  2. Use a configuration with a failing dependency:
    version: '3.8'
    services:
      redis:
        image: redis:alpine
        healthcheck:
          test: ["CMD-SHELL", "exit 1"]
          interval: 5s
          timeout: 3s
          retries: 5
          start_period: 10s
      hello:
        image: nginxdemos/hello
        ports:
          - "8080:80"
        depends_on:
          redis:
            condition: service_healthy
    
  3. Use testcontainers to start the compose stack:
    let environment = new DockerComposeEnvironment(
      __dirname,
      'docker-compose.yml',
    ).withDefaultWaitStrategy(Wait.forHealthCheck());
    await environment.up();
    
  4. Notice that the stack will fail to start without printing any container logs.

Environment Information

  • Operating System: Ubuntu 24.04.3 LTS
  • Docker Version: 28.0.4
  • Node version: 24.10.0
  • Testcontainers version: 11.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions