1

I am create a docker swarm service, If one of the container stops in a service it will immediately schedule docker container in one of available swarm nodes, I want to delay that schedule for 5 second am using docker API. in API version 1.26 docs there it's specify something like this

"RestartPolicy": { "Condition": "on-failure", "Delay": 10000000000, "MaxAttempts": 10 } what is ( Dealy :10000000000). is it milliseconds or nanoseconds ?

thisisms
  • 371
  • 5
  • 19
  • I believe that only applies to the docker engine's restart policy for a container. Swarm orchestration is at a layer above that and I'm not sure of the behavior when both are trying to restart the container. I do know there's an outstanding issue to add an exponential backoff from the current default of 0 seconds: https://github.com/docker/swarmkit/issues/1201 – BMitch Jun 14 '17 at 23:46

1 Answers1

0

The latest Docker API 1 doesn't specify, but we can assume that it's referring to nanoseconds, since the Healthcheck time durations are also in nanos:

**Interval** - The time to wait between checks in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.

**StartPeriod** - The time to wait for container initialization before starting health-retries countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
osman
  • 1,590
  • 1
  • 14
  • 21