mvn docker: остановка не вызывается после интеграционного теста
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<dependencies>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.23.0</version>
<configuration>
<keepContainer>false</keepContainer>
<removeVolumes>true</removeVolumes>
<images>
<image>
<alias>zookeeper</alias>
<name>jplock/zookeeper:3.4.6</name>
<run>
<ports>
<port>2181:2181</port>
</ports>
<log>
<prefix>ZOOKEEPER</prefix>
<color>yellow</color>
</log>
</run>
</image>
<image>
<alias>kafka</alias>
<name>wurstmeister/kafka:1.0.0</name>
<run>
<links>
<link>zookeeper:zookeeper</link>
</links>
<ports>
<port>9092:9092</port>
</ports>
<env>
<KAFKA_ADVERTISED_HOST_NAME>127.0.0.1</KAFKA_ADVERTISED_HOST_NAME>
<KAFKA_ADVERTISED_PORT>9092</KAFKA_ADVERTISED_PORT>
<KAFKA_CREATE_TOPICS>test:3:1</KAFKA_CREATE_TOPICS>
<KAFKA_ZOOKEEPER_CONNECT>zookeeper:2181</KAFKA_ZOOKEEPER_CONNECT>
<KAFKA_BROKER_ID>999</KAFKA_BROKER_ID>
</env>
<log>
<prefix>KAFKA</prefix>
<color>yellow</color>
</log>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
<goal>remove</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<environmentVariables>
<KAFKA_ADVERTISED_HOST_NAME>127.0.0.1</KAFKA_ADVERTISED_HOST_NAME>
<KAFKA_ADVERTISED_PORT>9092</KAFKA_ADVERTISED_PORT>
<KAFKA_TOPICS>test</KAFKA_TOPICS>
<KAFKA_CREATE_TOPICS>test:3:1</KAFKA_CREATE_TOPICS>
<KAFKA_ZOOKEEPER_CONNECT>zookeeper:2181</KAFKA_ZOOKEEPER_CONNECT>
<KAFKA_BROKER_ID>999</KAFKA_BROKER_ID>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
После запуска mvn integration-test
Я обнаружил, что доки-контейнеры все еще работают docker ps
, я должен бежать mvn docker:stop
остановить и удалить их вручную. Но mvn verify
может автоматически останавливать и удалять док-контейнеры. Зачем? Кто-нибудь может помочь? Спасибо