【发布时间】:2018-09-18 22:06:02
【问题描述】:
我有一个多模块 Maven 项目,我在同时进行多个 Jenkins 构建时遇到了 docker 端口冲突。
我在 pom.xml 文件中使用 docker-maven-plugin
我该如何解决这个问题?
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>start</id>
<phase>pre-integration-test</phase>
<goals>
<goal>stop</goal>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<images>
<image>
<name>guest/guest-main:${project.version}</name>
<alias>guest</alias>
<run>
<env>
<myapp_ENDPOINT>http://mock:8081/mycalcService</myapp_ENDPOINT>
</env>
<namingStrategy>alias</namingStrategy>
<dependsOn>
<container>mock</container>
</dependsOn>
<links>
<link>mock:mock</link>
</links>
<ports>
<port>guest.port:8080</port>
</ports>
<wait>
<log>Started guestServiceApplication</log>
<time>60000</time>
</wait>
</run>
</image>
<image>
<alias>mock</alias>
<name>guest/myapp-mock:${project.version}</name>
</image>
</images>
</configuration>
</plugin>
问候
【问题讨论】:
-
为什么需要在构建时公开端口?
-
我对此很陌生 - 请解释一下
-
你在使用 Jenkinsfile 吗?