[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于docker-maven-plugin构建镜像时出错 #62

Closed
shanyuguangyun opened this issue Jul 24, 2020 · 3 comments
Closed

关于docker-maven-plugin构建镜像时出错 #62

shanyuguangyun opened this issue Jul 24, 2020 · 3 comments

Comments

@shanyuguangyun
Copy link

你好,问下为啥我用docker-maven-plugin 构建镜像时报错呢,是有什么schema需要指定么 0 0

[INFO] Building image mall/mall-admin:1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.478 s
[INFO] Finished at: 2020-07-24T11:26:03+08:00
[INFO] Final Memory: 70M/819M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.1.0:build (build-image) on project mall-admin: Exception caught: Schema specific part is opaque. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.spotify:docker-maven-plugin:1.1.0:build (build-image) on project mall-admin: Exception caught
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception caught
at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:151)
at com.spotify.docker.BuildMojo.execute(BuildMojo.java:324)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: java.lang.IllegalArgumentException: Schema specific part is opaque.
at com.spotify.docker.client.shaded.org.glassfish.jersey.uri.internal.JerseyUriBuilder.checkSsp(JerseyUriBuilder.java:714)
at com.spotify.docker.client.shaded.org.glassfish.jersey.uri.internal.JerseyUriBuilder.path(JerseyUriBuilder.java:356)
at com.spotify.docker.client.shaded.org.glassfish.jersey.uri.internal.JerseyUriBuilder.path(JerseyUriBuilder.java:72)
at com.spotify.docker.client.shaded.org.glassfish.jersey.client.JerseyWebTarget.path(JerseyWebTarget.java:153)
at com.spotify.docker.client.shaded.org.glassfish.jersey.client.JerseyWebTarget.path(JerseyWebTarget.java:59)
at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1412)
at com.spotify.docker.client.DefaultDockerClient.build(DefaultDockerClient.java:1402)
at com.spotify.docker.BuildMojo.buildImage(BuildMojo.java:623)
at com.spotify.docker.BuildMojo.execute(BuildMojo.java:403)
at com.spotify.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:149)
... 23 more
[ERROR]
[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

@macrozheng
Copy link
Owner

应该是Docker版本和docker-maven-plugin插件版本不兼容问题,将插件升级到1.2.2版本可以解决。

@ForsythiaSuspensa
Copy link
ForsythiaSuspensa commented Feb 15, 2021

same question
Failed to execute goal com.spotify:docker-maven-plugin:1.2.2:build (build-image) on project mall-admin: Exception caught

@carrey-k
Copy link
carrey-k commented Jun 3, 2021

In macos, you need to enable the enable the remote Docker API by run docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 2376:2375 bobrik/socat TCP4-LISTEN:2375,fork,reuseaddr UNIX-CONNECT:/var/run/docker.sock.

Then set the dockerHost to unix:///var/run/docker.sock if you test it in your localhost

<plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>1.2.2</version>
                <executions>
                    <execution>
                        <id>build-image</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <imageName>mall-admin/${project.artifactId}:${project.version}</imageName>
                    <dockerHost>unix:///var/run/docker.sock</dockerHost>
                    <baseImage>java:8</baseImage>
                    <entryPoint>["java", "-jar", "-Dspring.profiles.active=prod","/${project.build.finalName}.jar"]
                    </entryPoint>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants