Docker mvn插件make {} - > unix:// localhost:80:管道损坏

时间:2018-04-18 13:55:29

标签: maven docker spring-boot microservices maven-docker-plugin

我使用spring-boot实现应用程序,并尝试使用此mvn插件构建docker镜像。

<plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <version>1.3.6</version>
                <executions>
                    <execution>
                        <id>default</id>
                        <phase>install</phase>
                        <goals>
                            <goal>build</goal>
                            <!-- <goal>push</goal> -->
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <repository>${docker.image.prefix}/${project.artifactId}</repository>

                    <buildArgs>
                        <JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
                    </buildArgs>
                </configuration>
            </plugin>

如果我尝试使用mvn clean install构建它,它会产生以下错误。

    Caused by: java.io.IOException: Broken pipe
    at jnr.enxio.channels.NativeSocketChannel.write(NativeSocketChannel.java:93)
    at java.nio.channels.Channels.writeFullyImpl(Channels.java:78)
    at java.nio.channels.Channels.writeFully(Channels.java:98)
    at java.nio.channels.Channels.access$000(Channels.java:61)
    at java.nio.channels.Channels$1.write(Channels.java:174)
    at org.apache.http.impl.io.SessionOutputBufferImpl.streamWrite(SessionOutputBufferImpl.java:124)
    at org.apache.http.impl.io.SessionOutputBufferImpl.flushBuffer(SessionOutputBufferImpl.java:136)
    at org.apache.http.impl.io.SessionOutputBufferImpl.write(SessionOutputBufferImpl.java:167)
    at ……………………..
org.apache.http.impl.io.SessionOutputBufferImpl.write(SessionOutputBufferImpl.java:179)
        at 
    [INFO] Building Docker context /Users/thamira/ProjectFolder/finalresearch/cloud-microservice-projet-eureka
    [INFO] 
    [INFO] Image will be built as springio/cloud-microservice-projet-Eureka:latest
    [INFO] 
    Apr 18, 2018 6:56:20 PM org.apache.http.impl.execchain.RetryExec execute
    INFO: I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:80: Broken pipe

我该如何解决这个问题。

1 个答案:

答案 0 :(得分:1)

检查$ {project.artifactId}名称。它包含大写词。“尤里卡” 它会给你带来错误。

[INFO] Image will be built as springio/cloud-microservice-projet-Eureka:latest

将其更改为cloud-microservice-projet-eureka

这里的问题是图像名称,大写字母和码头工具不允许图像名称有大写