maven构建docker镜像异常
由于没有配置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镜像异常的更多相关文章
- 使用docker Maven插件本地构建docker镜像并发布到远程服务器
1.登录网站https://start.spring.io/,生成一个基本的SpringBoot应用. 2.将应用导入Eclipse IDE并创建Application类.目录结构如下: Applic ...
- Maven插件构建Docker镜像
背景 微服务架构下,微服务在带来良好的设计和架构理念的同时,也带来了运维上的额外复杂性,尤其是在服务部署和服务监控上.单体应用是集中式的,就一个单体跑在一起,部署和管理的时候非常简单,而微服务是一个网 ...
- 多阶段构建Docker镜像
在Docker 17.05及更高的版本中支持支持一种全新的构建镜像模式:多阶段构建: 多阶段构建Docker镜像的最大好处是使构建出来的镜像变得更小: 目前常见的两个构建镜像的方式为: 1.直接使用某 ...
- 使用Jenkins pipeline流水线构建docker镜像和发布
新建一个pipeline job 选择Pipeline任务,然后进入配置页面. 对于Pipeline, Definition选择 "Pipeline script from SCM" ...
- 构建Docker镜像两种方式的比较-Dockerfile方式和S2I方式
前言 写Dockerfile是构建Docker镜像最通常的方式,接触过Docker的童鞋多少了解一些.前段时间研究OpenShift(paas的一种),发现了另外一种构建Docker镜像的方式:S2I ...
- [转] 构建Docker镜像两种方式的比较-Dockerfile方式和S2I方式
原文地址:https://www.cnblogs.com/tianshifu/p/8127837.html 前言 写Dockerfile是构建Docker镜像最通常的方式,接触过Docker的童鞋多少 ...
- 使用Buildpacks高效构建Docker镜像
1. 前言 Spring Boot 2.3.0.RELEASE 正式发布了几天了,其中有个新的特性:可以将Spring Boot应用代码直接打包为Docker镜像.这是什么科技?我赶紧去官网查了一番才 ...
- SpringBoot 构建 Docker 镜像的 3 种方式
本文将介绍3种技术,通过 Maven 把 SpringBoot 应用构建成 Docker 镜像. (1)使用 spring-boot-maven-plugin 内置的 build-image. (2) ...
- SpringBoot 构建 Docker 镜像的最佳 3 种方式
本文将介绍3种技术,通过 Maven 把 SpringBoot 应用构建成 Docker 镜像. (1)使用 spring-boot-maven-plugin 内置的 build-image. (2) ...
随机推荐
- MySQL的常用JSON函数
1. JSON_SEARCH(col ->> '$[*].key', type, val) col: JSON格式的字段名 key:要搜索的col字段的key type:可以为'one'或 ...
- UI自动化之读取浏览器配置
以火狐浏览器为例 目录 1.找到配置项 2.读取配置 1.找到配置项 打开Firefox点右上角设置>?(帮助)>故障排除信息>显示文件夹,复制文件管理器地址栏 2.读取配置 用Fi ...
- Java ——正则表达式
本节重点思维导图 详细见 ————> 正则表达式 [各种语法和方法]
- python_001
一.python开发1.python基础 -基础 -基本数据类型 -函数 -面向对象2.网络编程3.web框架 -用于写网站4.设计模式 + 算法
- 【FICO系列】SAP 财务帐与后勤不一致情况
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[FICO系列]SAP 财务帐与后勤不一致情况 ...
- 【SD系列】SAP 退货冲账过账成本更新
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[SD系列]SAP 退货冲账过账成本更新 前 ...
- WPF资源字典的使用
1.在解决方案中添加资源字典:鼠标右键——添加——资源字典 2.在资源字典中写入你需要的样式,我这里简单的写了一个窗体的边框样式 3.在App.xaml中加入刚刚新建的资源字典就好了
- 前端 CSS的选择器 伪类选择器 CSS3 nth-child()
first-child 选中第一个标签 应用CSS样式 <!DOCTYPE html> <html lang="en"> <head> < ...
- Java相关面试题总结+答案(八)
[RabbitMQ] 135. RabbitMQ 的使用场景有哪些? 抢购活动,削峰填谷,防止系统崩塌. 延迟信息处理,比如 10 分钟之后给下单未付款的用户发送邮件提醒. 解耦系统,对于新增的功能可 ...
- JAVA总结--jvm
VM,Virtual Machine 即虚拟机,指通过软件模拟的具有完整硬件系统功能的.运行在一个完全隔离环境中的完整计算机系统. JVM,Java Virtual Machine 即Java虚拟机, ...