Showing posts with label drain. Show all posts
Showing posts with label drain. Show all posts

Saturday, October 21, 2017

vSphere Integrated Containers (Docker Swarm) - Part 2


In my last post we created a Docker Swarm using DCH now lets look at a few cool things you can do with it.

The setup remains the same as the last post.


Scaling up and down


In our original example we had 6 replicas running.

Run the following to check the running processes -


             docker -H 10.156.134.141 service ps web


Lets bump it up to 10. To do this we use the docker service scale command

            docker -H 10.156.134.141 service scale web=10

And then check to see if the instances have been scaled to 10




To scale down just run the same command with the desired number of instances

            docker -H 10.156.134.141 service scale web=6

And check to see if the instances have been scaled down back to 6.




Draining the Node


Before draining a node let us make sure the number of running processes/instances and the corresponding worker nodes they are running on.


  • 1 on manager1
  • 1 on worker1
  • 2 on worker2
  • 2 on worker3
Run the following command to drain worker3

            docker -H 10.156.134.141 node update --availability drain worker3


As you can see web.8 and web.9 are shutdown on worker3 and are scheduled on manager1 and worker1 respectively.

Applying Rolling Updates 

The simplest of all commands. If the nginx image you deployed needs to be updated, just run - 

docker service update --image <imagename>:<version> web

Removing a service

Be careful using this command. It does not ask for confirmation.

docker service rm web