由于没有配置ip+2375端口,导致每次跑的时候,都是连接本地的,一直会报错

[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.5:build (server) on project web-service: Exception caught: 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, localhost/fe80:0:0:0:0:0:0:1%1] failed: Connection refused -> [Help 1]

研究了几个小时,终于解决了。

客户端:

加上  -H tcp://0.0.0.0:2375
[root@topcheer system]# cat docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
BindsTo=containerd.service
After=network-online.target firewalld.service containerd.service
Wants=network-online.target
Requires=docker.socket [Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always # Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3 # Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s # Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity # Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity # set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes # kill only the docker process, not all processes in the cgroup
KillMode=process [Install]
WantedBy=multi-user.target
[root@topcheer system]# pwd
/usr/lib/systemd/system
[root@topcheer system]#

重启docker,会发现2375起起来了

[root@topcheer system]# lsof -i:2375
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
dockerd 21337 root 7u IPv6 128286 0t0 TCP *:2375 (LISTEN)
[root@topcheer system]#

客户端:

2种选择

要不配置环境变量:

要不在pom.xml添加

<dockerHost>http://192.168.180.105:2375</dockerHost>

测试:

[INFO] Pushing 192.168.180.105:1180/topcheer/docker:1.0.2
The push refers to repository [192.168.180.105:1180/topcheer/docker]
75db466d4814: Preparing
82128b555bad: Preparing
35c20f26d188: Preparing
c3fe59dd9556: Preparing
6ed1a81ba5b6: Preparing
a3483ce177ce: Preparing
ce6c8756685b: Preparing
30339f20ced0: Preparing
0eb22bfb707d: Preparing
a2ae92ffcd29: Preparing a3483ce177ce: Waiting ce6c8756685b: Waiting 30339f20ced0: Waiting 0eb22bfb707d: Waiting a2ae92ffcd29: Waiting 35c20f26d188: Layer already exists c3fe59dd9556: Layer already exists 6ed1a81ba5b6: Layer already exists 75db466d4814: Layer already exists 82128b555bad: Layer already exists 0eb22bfb707d: Layer already exists a3483ce177ce: Layer already exists a2ae92ffcd29: Layer already exists ce6c8756685b: Layer already exists 30339f20ced0: Layer already exists
1.0.2: digest: sha256:65b55efa410146d044fa6feba6d9456f13f601f83a2ef73c91e0b0b7a8efc94c size: 2424
null: null
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.289 s
[INFO] Finished at: 2019-11-05T18:43:23+08:00
[INFO] ----------------------------------------------

maven构建docker镜像异常的更多相关文章

  1. 使用docker Maven插件本地构建docker镜像并发布到远程服务器

    1.登录网站https://start.spring.io/,生成一个基本的SpringBoot应用. 2.将应用导入Eclipse IDE并创建Application类.目录结构如下: Applic ...

  2. Maven插件构建Docker镜像

    背景 微服务架构下,微服务在带来良好的设计和架构理念的同时,也带来了运维上的额外复杂性,尤其是在服务部署和服务监控上.单体应用是集中式的,就一个单体跑在一起,部署和管理的时候非常简单,而微服务是一个网 ...

  3. 多阶段构建Docker镜像

    在Docker 17.05及更高的版本中支持支持一种全新的构建镜像模式:多阶段构建: 多阶段构建Docker镜像的最大好处是使构建出来的镜像变得更小: 目前常见的两个构建镜像的方式为: 1.直接使用某 ...

  4. 使用Jenkins pipeline流水线构建docker镜像和发布

    新建一个pipeline job 选择Pipeline任务,然后进入配置页面. 对于Pipeline, Definition选择 "Pipeline script from SCM" ...

  5. 构建Docker镜像两种方式的比较-Dockerfile方式和S2I方式

    前言 写Dockerfile是构建Docker镜像最通常的方式,接触过Docker的童鞋多少了解一些.前段时间研究OpenShift(paas的一种),发现了另外一种构建Docker镜像的方式:S2I ...

  6. [转] 构建Docker镜像两种方式的比较-Dockerfile方式和S2I方式

    原文地址:https://www.cnblogs.com/tianshifu/p/8127837.html 前言 写Dockerfile是构建Docker镜像最通常的方式,接触过Docker的童鞋多少 ...

  7. 使用Buildpacks高效构建Docker镜像

    1. 前言 Spring Boot 2.3.0.RELEASE 正式发布了几天了,其中有个新的特性:可以将Spring Boot应用代码直接打包为Docker镜像.这是什么科技?我赶紧去官网查了一番才 ...

  8. SpringBoot 构建 Docker 镜像的 3 种方式

    本文将介绍3种技术,通过 Maven 把 SpringBoot 应用构建成 Docker 镜像. (1)使用 spring-boot-maven-plugin 内置的 build-image. (2) ...

  9. SpringBoot 构建 Docker 镜像的最佳 3 种方式

    本文将介绍3种技术,通过 Maven 把 SpringBoot 应用构建成 Docker 镜像. (1)使用 spring-boot-maven-plugin 内置的 build-image. (2) ...

随机推荐

  1. C# datatable 与 xml文件之间的转换

    /// <summary> /// datatable转XML文件 /// </summary> /// <param name="dtTable"& ...

  2. uni-app-v-else中不需要值

    这个问题把我都高懵逼了 在vue中, 但是在uni-app中:v-else不需要值, 下面去掉值就Ok了

  3. 【ABAP系列】SAP ABAP 宏的简单使用

    公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP 宏的简单使用 ...

  4. rac节点挂掉后,vip飘到别的节点,但是业务连接不上报 no listener问题处理

    客户一套rac系统,三节点,其中一个节点的p260主机主板有问题(经常机器重启,好像是这个型号的通病,主板被炒到20W),临时把故障节点的vip作为业务地址用. 首先,查看确定故障节点vip飘到那个节 ...

  5. 取消a或input标签聚焦后出现虚线框

    1:在a标签里加入js控制,当a标签被聚焦时,强制取消焦点,这时候a标签自然不会有虚线框. <a href="#" onfocus="this.blur();&qu ...

  6. 第一个spring boot应用

    前提 首先要确保已经安装了java和maven: $ java -version java version "1.8.0_102" Java(TM) SE Runtime Envi ...

  7. Java{0}占位符替换字符串

    Java{0}占位符替换字符串 public class Test { public static void main(String[] args) { System.out.println(Stri ...

  8. HTML: 引号不能忽视

    在js中常常生成拼接html,然后放到dom中,但是有些拼接的html标签需要加一些指或者属性,这个时候不能忽略引号 如果data.link_tel有空格,不加单引号导致value的值不完全 str ...

  9. HDFS数据流——写数据流程

    剖析HDFS文件写入 假设文件ss.avi共200m,其写入HDFS指定路径/user/atguigu/ss.avi流程如下: 1)客户端向namenode请求上传文件到指定路径,namenode通过 ...

  10. Lucene 4.6.1 java.lang.IllegalStateException: TokenStream contract violation

    这是旧代码在新版本Lucene中出现的异常,异常如下: Exception in thread "main" java.lang.IllegalStateException: To ...