引起原因:com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException:org.apache.http.conn.HttpHostConnectException:微服务

时间:2018-10-29 10:02:44

标签: java microservices

我正在从https://github.com/kbastani/spring-cloud-microservice-example构建代码,并且Windows计算机上没有安装docker。我希望执行源代码。有人可以让我知道如何解决此错误吗?

我已经使用git下载了代码,并且存在.git文件夹。

Caused by: com.spotify.docker.client.DockerException: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
    at com.spotify.docker.client.DefaultDockerClient.propagate (DefaultDockerClient.java:1226)
    at com.spotify.docker.client.DefaultDockerClient.request (DefaultDockerClient.java:1167)
    at com.spotify.docker.client.DefaultDockerClient.version (DefaultDockerClient.java:330)
    at com.spotify.docker.client.DefaultDockerClient.authRegistryHeader (DefaultDockerClient.java:1265)
    at com.spotify.docker.client.DefaultDockerClient.build (DefaultDockerClient.java:918)
    at com.spotify.docker.client.DefaultDockerClient.build (DefaultDockerClient.java:877)
    at com.spotify.docker.BuildMojo.buildImage (BuildMojo.java:532)
    at com.spotify.docker.BuildMojo.execute (BuildMojo.java:322)
    at com.spotify.docker.AbstractDockerMojo.execute (AbstractDockerMojo.java:113)
    at com.spotify.docker.BuildMojo.execute (BuildMojo.java:81)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    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)

pom.xml

<build>
        <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>${docker.plugin.version}</version>
                <executions>
                    <execution>
                        <phase>install</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <imageName>${docker.image.prefix}/${project.artifactId}</imageName>
                    <dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>
        </plugins>
    </build>

1 个答案:

答案 0 :(得分:1)

通过右键单击通知区域中的Docker桌面图标进入Docker桌面的设置,然后选中(选择)在tcp:// localhost:2375上将守护进程暴露在没有TLS的情况下选项

引用:https://stackoverflow.com/a/45961484/3966432