Docker Community Forums

Share and learn in the Docker community.

Docker scale - auto-failure configuration in docker

Hi team, I have some doubts regarding docker scaling,
I have a java based container. Its should be processed and give responses to so many curl request from another point.
So we scaled it to 2 using docker scaling. So I have 2 doubts

  1. is the requests are hitting by the round-robin method?
  2. if one instance is down then it will automatically redirect to another one?
  3. if we are not getting a response after the 30s then redirect to the second instance ? is there any configuration to set this?

If you haven’t already, open a terminal and ssh into the machine where you run your manager node. For example, the tutorial uses a machine named manager1.

Run the following command to change the desired state of the service running in the swarm:

$ docker service scale =
For example:

$ docker service scale helloworld=5

helloworld scaled to 5
Run docker service ps to see the updated task list:

$ docker service ps helloworld

helloworld.1.8p1vev3fq5zm0mi8g0as41w35 alpine worker2 Running Running 7 minutes
helloworld.2.c7a7tcdq5s0uk3qr88mf8xco6 alpine worker1 Running Running 24 seconds
helloworld.3.6crl09vdcalvtfehfh69ogfb1 alpine worker1 Running Running 24 seconds
helloworld.4.auky6trawmdlcne8ad8phb0f1 alpine manager1 Running Running 24 seconds
helloworld.5.ba19kca06l18zujfwxyc5lkyn alpine worker2 Running Running 24 seconds
You can see that swarm has created 4 new tasks to scale to a total of 5 running instances of Alpine Linux. The tasks are distributed between the three nodes of the swarm. One is running on manager1.

Run docker ps to see the containers running on the node where you’re connected. The following example shows the tasks running on manager1:

$ docker ps

528d68040f95 alpine:latest “ping” About a minute ago Up About a minute helloworld.4.auky6trawmdlcne8ad8phb0f1

  1. if one instance is down then it will automatically redirect to another one?