br4chu / docker-compose-maven-plugin

Maven plugin that talks to docker-compose command-line interface
Apache License 2.0
12 stars 4 forks source link

docker-compose rm <service1> <service2> #10

Open Girivasan opened 3 years ago

Girivasan commented 3 years ago

First of all, really appreciate the effort you put here and this plugin is very useful.

I want to create containers each and every time. Sometimes containers with the same name present, and is throwing errors with the plugin when containers are starting with up goal. Could you add support for this ?

docker-compose rm

mjagus commented 3 years ago

Hi Girivasan,

Would introducing additional down goal execution in pre-integration-test phase fix your use-case? This would remove all dangling containers before docker-compose up gets called. Basically your executions block for the plugin would look something like:

<executions>
    <execution>
        <id>clean-before-up</id>
        <phase>pre-integration-test</phase>
        <goals>
            <goal>down</goal>
        </goals>
    </execution>
    <execution>
        <id>up</id>
        <phase>pre-integration-test</phase>
        <goals>
            <goal>up</goal>
        </goals>
    </execution>
    <execution>
        <id>down</id>
        <phase>post-integration-test</phase>
        <goals>
            <goal>down</goal>
        </goals>
    </execution>
</executions>