当前位置:网站首页>11.Service更新
11.Service更新
2020-11-07 16:43:00 【太猪-YJ】
创建overlay网关
docker create network --name demo overlay
创建Service
docker service create --name web --publish 8080:5000 --network demo taizhuyj/python-flask-demo:1.0
编写脚本,轮询服务
sh -c "while true; do curl 127.0.0.1:8080&&sleep 1; done"
每秒请求一次service服务,返回结果:
hello docker, version 1.0
更新Service,希望过程中业务不要中断
1.对需要更新的Service做一个scale,先横向扩展,不然单点做更新服务会停掉。
docker service scale web=2
2.对Service进行更新image
docker service update --help 查看更新命令
docker service update --image xiaopeng163/python-flask-demo:2.0 web
3.查看轮询结果,随着新版本更新完毕,请求结果由
hello docker, version 1.0
变成同时存在
hello docker, version 1.0
hello docker, version 2.0
随着scale全部更新,会变成全是
hello docker, version 2.0
hello docker, version 2.0
查看Service信息
docker service ps web
会发现有多个web信息,其中version1.0已经shutdown了,而新更新的version2.0正在Running,说明更新成功。
更新端口
docker service update --publish-rm 8080:5000 --publish-add 8080:5000 web
对网络端口的更新,无法做到不中断服务
版权声明
本文为[太猪-YJ]所创,转载请带上原文链接,感谢
https://my.oschina.net/xiaoyoung/blog/4706981
边栏推荐
- Benefits and functions of auto maintenance app development
- 2020-08-20: the difference between go and python?
- Dynamsoft barcode reader v7.5!
- [graffiti Internet of things footprints] panoramic introduction of graffiti cloud platform
- Windows 10 蓝牙管理页面'添加蓝牙或其他设备'选项点击无响应的解决方案
- 20 XR projects roadshows, nearly 20 capital institutions attended! We sincerely invite you to attend the 2020 qcomm XR eco Partner Conference
- 应用层软件开发教父教你如何重构,资深程序员必备专业技能
- ado.net and asp.net The relationship between
- 心理咨询app开发所具备的优点与功能
- 2020-11-06:go中,谈一下调度器。
猜你喜欢
Two dimensional code location and alarm system of Expressway
Stm32f030f4p6 compatible with smart micro mm32f031f4p6
1万辆!理想汽车召回全部缺陷车:已发生事故97起,亏损将扩大
Utility class functions (continuous update)
Count the number of project code lines
New features of vue3
Unexpected element.. required element
.NETCore3.1+ Vue.js Low code workflow engine
2020-09-04: do you understand the function call convention?
Exclusive interview with Alibaba cloud database for 2020 PostgreSQL Asia Conference: Zeng Wenjing
随机推荐
cubemx做stm32 USB开发
Do you really know how to use search engines?
How to manage the authority of database account?
高速公路二维码定位报警系统
VARCHART XGantt入门教程
FreeSWITCH视频会议“标准”解决方案
PHP backdoor hiding skills
Windows 10 蓝牙管理页面'添加蓝牙或其他设备'选项点击无响应的解决方案
Shanghai Pudong Development Bank, which frequently receives penalty tickets, has been cheated by hundreds of millions of yuan in loans, and lacks of internal control?
测试攻城狮必备技能点!一文带你解读DevOps下的测试技术
2020年新规,微信封号怎么快速解除?
Web API interface design: swaggerui document / unified response format / unified exception handling / unified authority verification
How to deploy Gantt chart quickly and correctly
Jenkins入门(二)声明式流水线Jenkins Pipeline
September 9, 2020: naked writing algorithm: two threads print numbers 1-100 in turn.
Practice of Xiaoxiong school development board: real equipment access of smart street lamp sandbox experiment
10000! Ideal car recalls all defective cars: 97 accidents have occurred and losses will be expanded
Exclusive interview with Alibaba cloud database for 2020 PostgreSQL Asia Conference: Zeng Wenjing
Unexpected element.. required element
Using JSON webtoken (JWT) to generate token in nodejs