Rancher agents after hardware/docker-engine restart


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?



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.

1 Like

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.