nattfodd
nattfodd

Reputation: 1900

Change Docker backoff time

There is a foreground process in a docker container. It depends on other service (Kafka), so if Kafka fails to start, container fails to start as well.

Docker tries to restart container after 30 seconds, then 1 minute, then 2 minutes, then 4, 8, 16, 32 etc (approximately numbers).

So when I turn outer service back, docker container does not start automatically, instead it waits for these 32, 64 minutes, and that's too much.

Is there any way to change this behavior, for example, to be linear - restart attempts every 1 minute?

PS. I use docker-compose.yml (v2) and set option restart: always

Upvotes: 2

Views: 1613

Answers (1)

fzgregor
fzgregor

Reputation: 1897

There is an open issue on GitHub requesting an upper bound on the restart time, as well as, this SO post from early last year indicating that what you want is currently not possible.

Upvotes: 3

Related Questions