一、问题描述

在Win10家庭版安装Docker成功后,准备将微服务打包Docker镜像执行maven打包命令出错(相关依赖以及必要配置都已配好)

二、错误日志
[ERROR] Failed to execute goal com.spotify:dockerfile-maven-plugin:
1.4.10:build (default-cli) on project api-gateway: Could not build image:
 java.util.concurrent.ExecutionException: 
 com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: com.spotify.docker.client.shaded.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 -> [Help 1]
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.PlainSocketImpl.waitForConnect (Native Method)
    at java.net.PlainSocketImpl.socketConnect (PlainSocketImpl.java:107)
    at java.net.AbstractPlainSocketImpl.doConnect (AbstractPlainSocketImpl.java:399)
    at java.net.AbstractPlainSocketImpl.connectToAddress (AbstractPlainSocketImpl.java:242)
    at java.net.AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl.java:224)
    at java.net.SocksSocketImpl.connect (SocksSocketImpl.java:403)
    at java.net.Socket.connect (Socket.java:608)
    at com.spotify.docker.client.shaded.org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket (PlainConnectionSocketFactory.java:74)
    at com.spotify.docker.client.shaded.org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect (DefaultHttpClientConnectionOperator.java:134)
    at com.spotify.docker.client.shaded.org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect (PoolingHttpClientConnectionManager.java:353)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.establishRoute (MainClientExec.java:380)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.MainClientExec.execute (MainClientExec.java:236)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.ProtocolExec.execute (ProtocolExec.java:184)
    at com.spotify.docker.client.shaded.org.apache.http.impl.execchain.RetryExec.execute (RetryExec.java:88)
三、解决方案
  • 勾选Expose daemon on tcp://localhost:2375 without TLS:将守护进程暴露给tcp:// localhost:2375

在这里插入图片描述
之后再次尝试打包,如果还是不行就是其他的问题

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐