Zero Downtime Deployment with Docker Rolling Updates

3 thoughts on “Zero Downtime Deployment with Docker Rolling Updates

  1. we have a Global mode service running and if we add “order: start-first”” option in stack file how at the same time both the containers will access the same port. Because as per our understanding when the new task or container become ready in our case curl that port then old task or container will be shutdown. So at one moment there would be port conflict happened. Or the theory is different.

    • Interesting question. Deploying 3 replicas or deploying in global mode only differs in the count. In replica mode it is still possible that 2 replicas could end up on the same machine (but typically are spread across machines). In global mode each machine gets only 1 container. That is, until such time as a rolling update with order:start-first causes a new container to spin up first before destroying the old container.

      In both scenarios, each container is assigned its own unique IP address on the overlay network. With replicas you would have 3 ip addresses and for global mode you would have 1 IP address for each worker node. When you deploy new image in global mode with order:start-first, then the new container is started with its new ip address and will coexist for a short time with the old container on a separate ip address. Docker continues to manage the virtual IP (VIP) and routes traffic to both old and new containers until such time that it removes the old container and of course updates the list of containers behind the VIP.

  2. Hi Mark, my question is:
    I have 1 container running an app, but when I nedd to update my stack, the oldest one stops and the new one is ready but starting the app. How can I put a command where the oldest one gets down after xx seconds (the time needed for the new one start the app).

    I have the order start-first, and my stop_grace_period: 50s even with version: 3.4 on stack deploy gave me stop_grace_period Additional property stop_grace_period is not allowed. Tks

Leave a Reply