Skip to content

Reusing of docker compose containers is not possible #288

@tiloio

Description

@tiloio

We have simple use case: We want to spin up some background containers (like a database or a file storage) to run our test against it. The test are cleaning the containers as they need. These containers should be reused on every test run so we save time in every TDD cycle.

We define these containers in a docker-compose.yml and use the docker-compose cli with docker-compose up.
docker-compose up reuses the container everytime with the option --no-recreate.
This approach is working fine.

If we try that with testcontainers we get everytime the error that the containers are already existing.

const composeFilePath = path.resolve(__dirname, "dir-containing-docker-compose-yml");
const composeFile = "docker-compose.yml";

const await new DockerComposeEnvironment(composeFilePath, composeFile).up();

According to the docs its also not possible to pass in options like --no-recreate.

Is testcontainers made to serve our usecase? Or should we stick to the raw docker-compose cli?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions