mvn全新安装-PbuildDocker不起作用

时间:2018-07-11 04:44:46

标签: java spring microservices

这是我的错误信息:

Step 9/10 : EXPOSE ${EXPOSED_PORT}
│[INFO] ------------------------------------------------------------------------
│[INFO] Reactor Summary:
│[INFO]
│[INFO] spring-petclinic-microservices ..................... SUCCESS [ 0.246 s]
│[INFO] spring-petclinic-admin-server ...................... FAILURE [ 10.753 s]
│[INFO] spring-petclinic-monitoring ........................ SKIPPED
│[INFO] spring-petclinic-customers-service ................. SKIPPED
│[INFO] spring-petclinic-vets-service ...................... SKIPPED
│[INFO] spring-petclinic-visits-service .................... SKIPPED
│[INFO] spring-petclinic-config-server ..................... SKIPPED
│[INFO] spring-petclinic-discovery-server .................. SKIPPED
│[INFO] spring-petclinic-api-gateway ....................... SKIPPED
│[INFO] spring-petclinic-tracing-server .................... SKIPPED
│[INFO] ------------------------------------------------------------------------
│[INFO] BUILD FAILURE
│[INFO] ------------------------------------------------------------------------
│[INFO] Total time: 11.951 s
│[INFO] Finished at: 2018-07-11T10:30:27+08:00
│[INFO] Final Memory: 75M/651M
│[INFO] ------------------------------------------------------------------------
│[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default) on project spri
│ng-petclinic-admin-server: Exception caught: EXPOSE requires at least one argument -> [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 artic
│les:
│[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
│[ERROR]
│[ERROR] After correcting the problems, you can resume the build with the command
│[ERROR] mvn -rf :spring-petclinic-admin-server

似乎暴露要求一个参数。应该是什么?

这是dockerfile。

我尝试将EXPOSE_PORT设置为228899无效。 此错误信息:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.13:build (default) on project spri
│ng-petclinic-admin-server: Exception caught: Request error: POST unix://localhost:80/build?buildargs=
│%7B%22ARTIFACT_NAME%22%3A%22spring-petclinic-admin-server-1.5.9%22%2C%22EXPOSED_PORT%22%3A%229090%22%
│7D&t=mszarlinski/spring-petclinic-admin-server: 500: HTTP 500 Internal Server Error -> [Help 1]
│[ERROR]

谢谢!

这是除pom.xml之外有关管理服务器的插件:

<profiles>
    <profile>
        <id>buildDocker</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>com.spotify</groupId>
                    <artifactId>docker-maven-plugin</artifactId>
                    <version>${docker.plugin.version}</version>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>

2 个答案:

答案 0 :(得分:0)

您还可以使用Jib进行设置

<configuration>
    <container>
        <ports>
            <port>xxxx</port>
        </ports>
    </container>
</configuration>

答案 1 :(得分:0)

EXPOSE指令通知Docker容器在运行时侦听指定的网络端口。您可以指定端口是侦听TCP还是UDP,如果未指定协议,则默认为TCP。

EXPOSE <port> [<port>/<protocol>...]

示例: EXPOSE 80/udp

Refer this.

see this.