Docker Swarm – Start Stop Node Container

In my previous blog Docker Swarm – Beginning I’ve started a service called “web” in global mode which runs a single instance of container on all nodes in the swarm. Now lets try to stop container/node and check the behavior.

Stop container – As you can see in the below screenshot stopping a container quickly started one more instance of container on the same node.

Docker_Swarm_Stop1

Stop node – I’ve stopped one of the node but there is no scale up/down of containers – single container on each of existing nodes.

Docker_Swarm_Stop2

Start node – So I’ve started the node again and it is immediately joined back the swarm.

Docker_Swarm_Start.JPG

And as expected container started on the node..

Docker_Swarm_Start2.JPG

Now lets remove it and start service in replica mode ( three replicas ) which started containers on all three nodes.

Docker_Swarm_Replica.JPG

Stop container – Just as in global mode stopping a container on node immediately starting on the same node.

Docker_Swarm_Replica2.JPG

Stop node – I’ve stopped one of the nodes and immediately docker started one more container on worker node2 so two in total running on the same node.

Docker_Swarm_Replica3.JPG

On worker node 2

Docker_Swarm_Replica4.JPG

Start node – I’ve started the node again and it is immediately joined back the swarm but unlike global mode as three containers already running ( 2 on worker node2 and one on manager node ) nothing started on worker node 1.

Docker_Swarm_Replica5.JPG

Docker_Swarm_Replica6.JPG

Now on worker node 2 – I’ve stopped one of the running containers and now docker started it on worker node 1.

Docker_Swarm_Replica7.JPG

Docker_Swarm_Replica8.JPG

 

 

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s