Hi there, fellow docker enthusiasts,
I somehow fail to find a decent reading on how Swarm handles image upgrades. Let me give an example to make sure my question is clear:
Let’s say I have some HA cluster of web server containers, using a docker image I built and managed by Docker Swarm. The name:tag of my image is webserver:release. Those containers sit behind a nice load balancer, they use some distributed session tool in another set of containers, etc., so my system is ticking like a clock. I, however, decide to upgrade my web server image for some reason, so I build a newer version of webserver, tag it :release and push it to DockerHub. This is where things get blurry for me: Now if I use Compose with Machine, just running
docker-compose up against the Swarm master and it should be able to detect I have newer version of the image and start replacing my webserver containers. What I don’t want to end up with, however, is an interruption in my service, if for some reason Swarm decides to bring all my webserver containers down at the same time. Even if it is a short interruption, it is still an unwanted interruption that defies the purpose of me building my HA cluster in the first place.
So what I need to understand is how Swarm actually handles those container upgrades and a couple of questions stem fron here:
- Does Swarm somehow bring down containers one by one? Are there any policies that can be defined to control this process?
- Does Swarm allow a graceful shutdown of the containers before upgrading them and if yes - is there a timeout setting before a hard shutdown occurs?
- Any mechanism to prevent upgrades upgrades getting messy - if I push two versions in a quick succession, this may trigger two simultaneous upgrades running in parallel…and things may get quite ugly.
- Does Swarm have the capability to let me inform my load balancer the container is down for maintenance/back up and running (HAProxy style)?
I’ve been looking for a decent reading on those problems/questions, but couldn’t find any so now I’m at the point of thinking I’m somehow getting it wrong and upgrading containers without interrupting service is totally out of Swarm’s remit.
Any thoughts or guidance will be greatly appreciated.