# How does rancher kill/restart containers

**URL:** <https://forums.suse.com/t/how-does-rancher-kill-restart-containers/4146>\
**Category:** General\
**Created:** [September 30, 2016, 8:42am UTC](https://forums.suse.com/t/how-does-rancher-kill-restart-containers/4146 "2016-09-30T08:42:02Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![guzmo](https://avatars.discourse-cdn.com/v4/letter/g/a3d4f5/32.png) [@guzmo](https://forums.suse.com/u/guzmo)\
**Post date:** [September 30, 2016, 8:42am UTC](https://forums.suse.com/t/how-does-rancher-kill-restart-containers/4146/1 "2016-09-30T08:42:02Z")

</div>

I would like to know how rancher kills/restart containers, do you send a SIGHUP or do you just force kill the containers?  
We have an application that really needs a SIGHUP to gracefully shutdown. I haven’t looked that much into it and maybe docker takes care of it?

---

<div class="post-metadata">

**Author:** ![alexb](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexb](https://forums.suse.com/u/alexb)\
**Post date:** [September 18, 2017, 5:06pm UTC](https://forums.suse.com/t/how-does-rancher-kill-restart-containers/4146/2 "2017-09-18T17:06:36Z")

</div>

I know this question is old, but I also really need to know this. I cannot find any documentation about how Rancher stops/restarts/upgrades containers. Does it send a signal like SIGHUP, SIGTERM, or SIGINT? Is there some kind of timeout period? Does it kill the container even if the underlying process is still running? All of this information is absolutely critical for using Rancher in a serious, production context.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [September 18, 2017, 5:30pm UTC](https://forums.suse.com/t/how-does-rancher-kill-restart-containers/4146/3 "2017-09-18T17:30:05Z")

</div>

We call the docker remote API and do nothing special. The defaults are SIGTERM (`stopSignal`), wait ten seconds (`stopTimeout`), then SIGKILL.

---

<div class="post-metadata">

**Author:** ![alexb](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexb](https://forums.suse.com/u/alexb)\
**Post date:** [September 18, 2017, 5:35pm UTC](https://forums.suse.com/t/how-does-rancher-kill-restart-containers/4146/4 "2017-09-18T17:35:51Z")

</div>

Thanks for the quick reply @vincent. Is that process also used for upgrades?

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [September 18, 2017, 6:05pm UTC](https://forums.suse.com/t/how-does-rancher-kill-restart-containers/4146/5 "2017-09-18T18:05:37Z")

</div>

Yes; that default behavior has always been the case, the ability to change them in API/compose is fairly new, and only in the upcoming 2.0 UI.

---

<div class="post-metadata">

**Author:** ![alexb](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexb](https://forums.suse.com/u/alexb)\
**Post date:** [September 18, 2017, 6:07pm UTC](https://forums.suse.com/t/how-does-rancher-kill-restart-containers/4146/6 "2017-09-18T18:07:22Z")

</div>

Great. Can we add this to the documentation at [http://rancher.com/docs/rancher/v1.6/en/cattle/upgrading/](http://rancher.com/docs/rancher/v1.6/en/cattle/upgrading/)? Is that something I can do?

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [September 18, 2017, 6:19pm UTC](https://forums.suse.com/t/how-does-rancher-kill-restart-containers/4146/7 "2017-09-18T18:19:22Z")

</div>

We don’t generally document standard Docker behavior…

> **[docker run](https://docs.docker.com/engine/reference/commandline/run/#stop-container-with-signal-stop-signal)**
>
> Description Run a command in a new container Usage docker run \[OPTIONS\] IMAGE \[COMMAND\] \[ARG...\] Options Name, shorthand Default Description --add-host Add a custom host-to-IP mapping (host:ip) --attach , -a...

> **[Compose file version 2 reference](https://docs.docker.com/compose/compose-file/compose-file-v2/#stop_grace_period)**
>
> Reference and guidelines These topics describe version 2 of the Compose file format. Compose and Docker compatibility matrix There are several versions of the Compose file format – 1, 2,...

But the docs are a Jekyll repo:

> **[rancher/rancher.github.io](https://github.com/rancher/rancher.github.io)**
>
> Contribute to rancher.github.io development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![alexb](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexb](https://forums.suse.com/u/alexb)\
**Post date:** [September 18, 2017, 6:40pm UTC](https://forums.suse.com/t/how-does-rancher-kill-restart-containers/4146/8 "2017-09-18T18:40:48Z")

</div>

I don’t think it’s necessary to repeat anything that already exists on `docs.docker.com`, but at least mentioning that Rancher uses the remote docker API and inherits those defaults (and maybe even linking to the relevant pages on `docs.docker.com`) would go a long way toward helping people like me understand what actually happens when you stop/restart/upgrade services with Rancher. The existing documentation doesn’t elaborate any further than saying Rancher “stops the existing containers”. If you have been using Rancher for a while or working on Rancher/Cattle internals, it probably seems obvious what that means but it was not obvious to me as a newcomer.

Anyways, thanks for your reply. I was able to solve the issue and set up graceful shutdowns for our application. I might move the discussion about docs to [https://github.com/rancher/rancher.github.io](https://github.com/rancher/rancher.github.io) if I have time later.
