Let's say I have the following setup:

swarm-00: Manager
swarm-01: Worker
swarm-02: Worker

Now I start a new nginx service

docker service create --replicas 2 --health-cmd /check.sh --restart-max-attempts 2 nginx

The service has started

NAME                                    IMAGE   NODE     DESIRED STATE  LAST STATE
nginx.1.1p1vev3fq5zm0mi8g0as41w35       alpine  swarm01  Running        Running 3 minutes
nginx.1.2s2shjer934jijfr09oioe090       alpine  swarm02  Running        Running 2 minutes

Now let's say for some reason health check always fails on nginx.1.2 on swarm02.

Once it restarts and have maxed out the total retries of 2 (or even without exhausting the retries), I want it to completely avoid swarm02 and try on other worker nodes instead. Acting like a dynamic constraint.

Is this possible?

  • Yes, take swarm 02 offline... (if the host is the failure cause then fix bring the host down and fix it...) – Tensibai May 16 '18 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.