Skip to content

[Enhancement]: DockerComposeContainer: Add option for down -v in stop() #7008

@gabrielsson

Description

@gabrielsson

Module

Core

Proposal

As the testcontainers-python issue testcontainers/testcontainers-python#178

We have the same thing with

    @Override
    public void stop() {
        ...
                // Kill the services using docker-compose
                String cmd = "down -v";
                if (removeImages != null) {
                    cmd += " --rmi " + removeImages.dockerRemoveImagesType();
                }
                runWithCompose(cmd);

        ...
    }

It would be be a good thing to introduce a parameter much like the removeImages

to something like

    @Override
    public void stop() {
        ...
                // Kill the services using docker-compose
                String cmd = "down";
                if (removeVolumes == true) { //defaults to true
                    cmd += " -v";
                }
                if (removeImages != null) {
                    cmd += " --rmi " + removeImages.dockerRemoveImagesType();
                }
                runWithCompose(cmd);

        ...
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions