# Rancher agents after hardware/docker-engine restart

**URL:** <https://forums.suse.com/t/rancher-agents-after-hardware-docker-engine-restart/3224>\
**Category:** Rancher 1.x\
**Created:** [June 27, 2016, 8:47am UTC](https://forums.suse.com/t/rancher-agents-after-hardware-docker-engine-restart/3224 "2016-06-27T08:47:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexR](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@alexR](https://forums.suse.com/u/alexR)\
**Post date:** [June 27, 2016, 8:47am UTC](https://forums.suse.com/t/rancher-agents-after-hardware-docker-engine-restart/3224/1 "2016-06-27T08:47:32Z")

</div>

Hello!

I am wondering what is the best practice for this. What happens if for x,y,z reason I need to restart the hardware host where a rancher-agent is running. When we add a custom host to an environemnt the generated bash command does not include a “–restart always” flag.

I am wondering what is the right thing to do. Right now what I’ve done is search through the history and find the generated bash command and re-run it, but I am sure that is not the proper way to do it.

Could someone share what is the correct procedure for this?

Thanks!

Alejandro

---

<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:** [June 27, 2016, 6:43pm UTC](https://forums.suse.com/t/rancher-agents-after-hardware-docker-engine-restart/3224/2 "2016-06-27T18:43:38Z")

</div>

The command that is shown creates a data volume, starts the actual agent, and then exits. If you look at the container that is actually running afterwards it has the equivalent of `--restart=always`.

---

<div class="post-metadata">

**Author:** ![alexR](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@alexR](https://forums.suse.com/u/alexR)\
**Post date:** [June 28, 2016, 2:33pm UTC](https://forums.suse.com/t/rancher-agents-after-hardware-docker-engine-restart/3224/3 "2016-06-28T14:33:47Z")

</div>

Well, you are absolutely right.  
`

```
# docker inspect --format '{{ .HostConfig.RestartPolicy.Name }} {{ .HostConfig.RestartPolicy.MaximumRetryCount }}' ae07fe3893e3
always 0 
# service docker stop
# service docker start
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ae07fe3893e3 rancher/agent:v1.0.2 "/run.sh run" 30 hours ago Up 3 seconds rancher-agent

```

`

I wonder what is that I observed at other times, maybe I was just not patient enough. Thanks a lot.

Alejandro
