关于docker:710-Service更新

39次阅读

共计 1185 个字符,预计需要花费 3 分钟才能阅读完成。

我的项目初始化

# 在 swarm-manager 节点上
docker network create -d overlay demo
docker service create --name web -p 8080:5000 --network demo xiaopeng163/python-flask-demo:1.0
docker service scale web=3

继续拜访,模仿热更新的过程

# 在 swarm-work2 节点上
[vagrant@swarm-work2 ~]$ sh -c "while true;do curl 127.0.0.1:8080 && sleep 1;done"

我的项目降级

# 在 swarm-manager 节点上
docker service update --image xiaopeng163/python-flask-demo:2.0 web

继续拜访的后果

从 1.0 逐渐地过渡到 2.0

hello docker, version 1.0
hello docker, version 1.0
hello docker, version 1.0
hello docker, version 1.0
hello docker, version 1.0
hello docker, version 2.0
hello docker, version 1.0
hello docker, version 2.0
hello docker, version 1.0
hello docker, version 2.0
hello docker, version 1.0
hello docker, version 2.0
hello docker, version 1.0
hello docker, version 2.0
hello docker, version 1.0
hello docker, version 2.0
hello docker, version 1.0
hello docker, version 2.0
hello docker, version 1.0
hello docker, version 2.0
hello docker, version 2.0
hello docker, version 2.0
hello docker, version 2.0

Docker Stack 的更新

在更新了 docker-compose.yml 之后,再次执行一次 deploy 指令即可

# 并不存在 update 指令
[vagrant@swarm-manager wordpress-overlay]$ docker stack
Usage:    docker stack COMMAND
Manage Docker stacks
Commands:
  deploy Deploy a new stack or update an existing stack
  ls List stacks
  ps List the tasks in the stack
  rm Remove one or more stacks
  services List the services in the stack

正文完
 0