Service/container connection draining


This is more of a question to understand if docker has something as what I need or not.

I have this service:

version: '3.7'
    image: redis
      endpoint_mode: dnsrr
        delay: 30s
        order: start-first

When updating the service, the old container gets removed as soon as the new is started (and the DNS records are updated in that moment).

Is there a way to tell to docker to wait for some time before removing the old container? Some kind of connection-draining time to allow the other services to get the new IP?

The immediate removal of the old container always causes downtime since the DNS change and container removal are done together. I think that the container should be removed some time after the DNS change (and that time should be configurable).
In this way, the application that consumes the service will have enough time to update the DNS record, and in that time the container scheduled for removal should be still available.

Resolved setting properly process_control_timeout that decides how long to wait before removing the container (but in the meanwhile updated the DNS)