Skip to content

terminating test containers makes all container unreachable #1069

@zYasser

Description

@zYasser

Expected Behaviour
Tests should be able to connect to the database container normally after startup.
...

Actual Behaviour
After terminating a test run using Ctrl+C, all subsequent tests fail because the database container becomes unreachable. Although the container is still visible in Docker, it along with all other running containers becomes completely inaccessible. The only workaround is to restart Docker entirely.
...

Testcontainer Logs
...

Steps to Reproduce

  1. Run tests using Jest.

  2. Start a PostgreSQL container with the following setup: const container = await new PostgreSqlContainer(image) .withDatabase(database) .withUsername(username) .withPassword(password) .withExposedPorts(5432).withWaitStrategy(Wait.forLogMessage('database system is ready to accept connections', 1)) .start()

  3. While the tests are running, press Ctrl+C to forcibly terminate the process.

  4. Re-run the tests. They now fail, and all Docker containers become unreachable.

Environment Information

  • Operating System:Windows 10
  • Docker Version:Docker version 26.1.1, build 4cf5afa
  • Node version:v20.15.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