我正在尝试与maven,docker和Cassandra进行一些集成测试。
现在,我已经编写了一个虚拟代码来查询Cassandra并尝试maven运行Cassandra容器。
这是关于插件的pom.xml:
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.14.1</version>
<configuration>
<images>
<image>
<alias>some-cassandra</alias>
<name>cassandra:3.0</name>
<run>
<ports>
<!--<port>cassandra.port:9042</port>-->
<port>9042:9042</port>
<port>9160:9160</port>
<port>7199:7199</port>
<port>7001:7001</port>
</ports>
<wait>
<log>database system is ready to accept connections</log>
<time>30000</time>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<!-- "build" should be used to create the images with the
artifact -->
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
当我尝试运行它时,首先我收到有关DOCKER_NAME不可用的错误,我设置了一个具有不同名称的系统变量:“default”,“localhost”等等。
我不知道我在哪里可以查看该名称,我尝试了docker-machine inspect
,似乎名称是“默认”
最后,当我设置DOCKER_NAME时(我不知道它是否正确,但我猜不是)。我收到Maven的错误
[INFO] --- docker-maven-plugin:0.14.1:start (start) @ integration ---
**[ERROR] DOCKER> Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
[ERROR] DOCKER> Error occurred during container startup, shutting down...**
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.595 s
[INFO] Finished at: 2017-04-12T16:31:55+02:00
[INFO] Final Memory: 23M/312M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.14.1:start (start) on project integration: I/O Error: Unable to check image [cassandra:3.0] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Process finished with exit code 1
是否有人在Windows中使用此插件?