# Docker swarm and rolling restarts

**URL:** https://discuss.elastic.co/t/docker-swarm-and-rolling-restarts/56738
**Category:** Elasticsearch
**Created:** [July 29, 2016, 2:22pm UTC](https://discuss.elastic.co/t/docker-swarm-and-rolling-restarts/56738 "2016-07-29T14:22:37Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jillesvangurp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jillesvangurp/32/3863_2.png) [@jillesvangurp](https://discuss.elastic.co/u/jillesvangurp)
#### Post date: [July 29, 2016, 2:22pm UTC](https://discuss.elastic.co/t/docker-swarm-and-rolling-restarts/56738/1 "2016-07-29T14:22:37Z")

</div>

I'm currently investigating using elasticsearch with docker swarm and docker service. One headache is how to orchestrate rolling restarts with this. Specifically, I want the cluster to stay green throughout the process with zero downtime. Typical rolling restarts would be needed for config changes, elasticsearch updates, taking into use new hw, or cluster trouble (e.g. ooms with logstsash/kibana).

It appears docker swarm has support for updating service containers one by one and waiting a specified amount of time in between. This is not ideal since I've seen node restarts take ages on es clusters with a lot of logstash data. So, there's a big risk of either not waiting long enough (red cluster, data loss) or too long (wasted time). Also, if there is a problem with one of the nodes, there needs to be a way to go in and fix things. Finally, I'd prefer something that is automated. I've been babysitting cluster updates manually and it's a pain in the ass every time plus I don't trust myself to do it right every time.

I'd love to hear from people who have figured out a way to do this or any best practices around this.

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [July 29, 2016, 9:08pm UTC](https://discuss.elastic.co/t/docker-swarm-and-rolling-restarts/56738/2 "2016-07-29T21:08:13Z")

</div>

Did you try docker swarmkit?

> **[First Look at Docker SwarmKit](https://blog.replicated.com/first-look-at-docker-swarmkit/)**
>
> I was planning to deploy a test environment for a new application today, then the release of Docker SwarmKit came. I saw this as the perfect opportunity to spend part of the day giving SwarmKit a try. This post is a very early look at my experience...

With the info of this issue

[https://github.com/docker/swarmkit/issues/1085](https://github.com/docker/swarmkit/issues/1085)

I conclude a Dockerfile HEALTHCHECK command

> **[| Docker Documentation](https://docs.docker.com/engine/reference/builder/#/healthcheck)**
>
> Dockerfile reference Docker can build images automatically by reading the instructions from a Dockerfile. A Dockerfile is a text document that contains all the commands a user could call on...

could be a curl/wget/whatever command to retrieve the node recovery status. I haven't tried for myself - just reading the docs.

To be honest, I expect something like an official Elasticsearch docker image that makes best use of the swarmkit features.

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [July 29, 2016, 9:31pm UTC](https://discuss.elastic.co/t/docker-swarm-and-rolling-restarts/56738/3 "2016-07-29T21:31:48Z")

</div>

Perfect timing:

> **[Docker Built-in Orchestration Ready for Production: Docker 1.12 Goes GA - Docker...](https://blog.docker.com/2016/07/docker-built-in-orchestration-ready-for-production-docker-1-12-goes-ga/)**
>
> We wanted to thank everyone in the community for helping us achieve this great milestone of making Docker 1.12 generally available for production environments. Docker 1.12 adds the largest and most sophisticated set of features into a single release...

---

<div class="post-metadata">

### Author: ![jillesvangurp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jillesvangurp/32/3863_2.png) [@jillesvangurp](https://discuss.elastic.co/u/jillesvangurp)
#### Post date: [July 30, 2016, 9:06am UTC](https://discuss.elastic.co/t/docker-swarm-and-rolling-restarts/56738/4 "2016-07-30T09:06:38Z")

</div>

Thanks, that looks like it partly covers what I need. I'll be playing with this in the next few months probably.

---

<div class="post-metadata">

### Author: ![jillesvangurp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jillesvangurp/32/3863_2.png) [@jillesvangurp](https://discuss.elastic.co/u/jillesvangurp)
#### Post date: [August 26, 2016, 9:15am UTC](https://discuss.elastic.co/t/docker-swarm-and-rolling-restarts/56738/5 "2016-08-26T09:15:02Z")

</div>

I spend some more time on this and on the off chance that somebody trying the same ends up here, I wrote up an article on how to run Elasticsearch in Docker swarm 1.12.

> **[Running Elasticsearch in a Docker 1.12 Swarm](http://www.jillesvangurp.com/2016/08/26/running-elasticsearch-in-a-docker-1-12-swarm/)**
>
> My last blog post was on running consul in Docker Swarm. The reason I wanted to that is because I want to run Elasticsearch in swarm so that I can use swarm service discovery to enable other contai…

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 10:25pm UTC](https://discuss.elastic.co/t/docker-swarm-and-rolling-restarts/56738/6 "2017-07-05T22:25:00Z")

</div>


