当前位置:网站首页>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
边栏推荐
- Git SSH bad permissions
- 2020-08-15: under what circumstances should data tasks be optimized?
- VARCHART XGantt入门教程
- 10000! Ideal car recalls all defective cars: 97 accidents have occurred and losses will be expanded
- Getting started with varhart xgantt
- Characteristics of magnetic memory chip STT-MRAM
- WebAPI接口设计:SwaggerUI文档 / 统一响应格式 / 统一异常处理 / 统一权限验证
- 甘特图对活动进行分组教程
- Unexpected element.. required element
- 如何使用甘特图图层和筛选器
猜你喜欢
Nodejs中使用jsonwebtoken(JWT)生成token的场景使用
image operating system windows cannot be used on this platform
2020-09-04: do you understand the function call convention?
Using JSON webtoken (JWT) to generate token in nodejs
Windows 10 蓝牙管理页面'添加蓝牙或其他设备'选项点击无响应的解决方案
Method of code refactoring -- Analysis of method refactoring
August 30, 2020: naked write algorithm: the nearest common ancestor of two nodes in a binary tree.
Unexpected element.. required element
2020-08-20: the difference between go and python?
cubemx做stm32 USB开发
随机推荐
yum [Errno 256] No more mirrors to try 解决方法
谈了多年的数字化转型,为什么还有很多企业依然“口头管理”
20个XR项目路演,近20个资本机构出席!诚邀您参加2020 Qualcomm XR生态合作伙伴大会
Application layer software development Godfather teaches you how to refactor, senior programmers must professional skills
cubemx做stm32 USB开发
C calls SendMessage to refresh the taskbar icon (the icon does not disappear at the end of forcing)
Benefits and functions of auto maintenance app development
南京标识标牌设计制作,导视VI系统设计
Characteristics of magnetic memory chip STT-MRAM
Method of code refactoring -- Analysis of method refactoring
Google browser realizes video playback acceleration function
2020-08-19: what mechanism does TCP ensure reliability?
Dynamsoft barcode reader v7.5!
Detect certificate expiration script
如何才能快速正确的部署甘特图
Win7 how to quickly type CMD and get to the required directory
image operating system windows cannot be used on this platform
[learning] interface test case writing and testing concerns
Test the necessary skill points of siege lion! This article takes you to interpret the testing technology under Devops
2020-08-17: how to solve data skew in detail?