0

I would like containers in one of my docker stack services to automatically be refreshed every hour.

I start with 3 instances, and every hour I would like them to be replaced with new instances one at a time, serially.

Is there a way to achieve this with docker-compose? Or alternatively with a cron job?

Thanks!

Salvatore Iovene
  • 2,064
  • 1
  • 17
  • 31
  • Why do you want this? – ruohola Dec 11 '20 at 07:18
  • Even tho the process running inside my docker container has its own failsafe mechanisms (it's `gunicorn`, and I set it up to rotate worker after a maximum number of connections, and so on), and my docker container has a memory usage cap (that is not really reaching anyway), too often one such container will not be very responsive. Having a max lifetime is the easiest way to fix the issue and there is no downtime as I run these containers with redundancy anyway. – Salvatore Iovene Dec 11 '20 at 07:55
  • `too often one such container will not be very responsive` I would start by fixing that. – ruohola Dec 11 '20 at 08:21
  • I have tried and invested enough time in it, so next is the nuclear solution, hence this question :) – Salvatore Iovene Dec 11 '20 at 08:42

0 Answers0