无法使用spotify插件构建Docker镜像

时间:2016-06-01 23:57:41

标签: docker spring-boot spotify

我一直在使用spotify插件来构建docker图像,但由于某种原因它突然停止工作,并且它在spotify插件上发出错误抱怨exec失败

[INFO] 
[INFO] --- maven-jar-plugin:2.5:jar (default-jar) @ SimpleWebApp ---
[INFO] Building jar: /home/test/opd_workspace/my_simple_webapp/target/SimpleWebApp-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- spring-boot-maven-plugin:1.3.5.RELEASE:repackage (default) @ SimpleWebApp ---
[INFO] 
[INFO] --- docker-maven-plugin:0.2.3:build (default-cli) @ SimpleWebApp ---
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Copying /home/test/opd_workspace/my_simple_webapp/target/SimpleWebApp-0.0.1-SNAPSHOT.jar -> /home/test/opd_workspace/my_simple_webapp/target/docker/SimpleWebApp-0.0.1-SNAPSHOT.jar
[INFO] Copying src/main/docker/Dockerfile -> /home/test/opd_workspace/my_simple_webapp/target/docker/Dockerfile
[INFO] Building image imgprefix/SimpleWebApp
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.282s
[INFO] Finished at: Wed Jun 01 19:42:14 EDT 2016
[INFO] Final Memory: 27M/340M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.3:build (default-cli) on project SimpleWebApp: Exception caught: Request error: POST unix://localhost:80/v1.12/build?t=imgprefix/SimpleWebApp: 500: HTTP 500 Internal Server Error -> [Help 1]

我的pom.xml插件非常简单,maven项目构建和包也没问题

<plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.2.3</version>
                <configuration>
                    <imageName>${docker.image.prefix}/${project.artifactId}</imageName>
                    <dockerDirectory>src/main/docker</dockerDirectory>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>
        </plugins>

2 个答案:

答案 0 :(得分:2)

关注这一行:

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.2.3:build (default-cli) on project SimpleWebApp: Exception caught: Request error: POST unix://localhost:80/v1.12/build?t=imgprefix/SimpleWebApp: 500: HTTP 500 Internal Server Error -> [Help 1]

您似乎使用UNIX作为操作系统,Docker会回答错误500.

我正在使用MACOS并且它与我的配置完全相同,但在我需要在终端中评估Docker环境变量之前:

eval $(docker-machine env default)

答案 1 :(得分:1)

使用该库,您无法使用大写的存储库名称。只允许[a-z0-9-_。]。

所以改变

  

SimpleWebApp

  

简单web应用

或类似的东西。