7.10 service update

Time:2021-10-15

Project initialization

#On the swarm manager node
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

Continuous access to simulate the process of hot update

#On the swarm-work2 node
[[email protected] ~]$ sh -c "while true;do curl 127.0.0.1:8080 && sleep 1;done"

Project upgrade

#On the swarm manager node
docker service update --image xiaopeng163/python-flask-demo:2.0 web

Results of continuous access

Gradual transition from 1.0 to 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

Update of docker stack

After the docker-compose.yml is updated, execute it againdeployCommand is enough

#There is no update instruction
[[email protected] 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

Recommended Today

Swift advanced (XV) extension

The extension in swift is somewhat similar to the category in OC Extension can beenumeration、structural morphology、class、agreementAdd new features□ you can add methods, calculation attributes, subscripts, (convenient) initializers, nested types, protocols, etc What extensions can’t do:□ original functions cannot be overwritten□ you cannot add storage attributes or add attribute observers to existing attributes□ cannot add parent […]