How to debug new host not registering with Rancher


I’ve just set up a new Rancher server, and am attempting to connect a new host to it, using the “custom” option to add a host.

Traffic is routable between the host and Rancher itself, but for some reason, Rancher is never finding out about it.

The logs show a heap of stuff, but in all of that I’m not clear which bits I should be worrying about.

How would you suggest I go about debugging a host that won’t register?

(note, when I first tried this, I had local auth enabled. However, I disabled it, and still attempting to register a host refused to work)

try the following to see if the host can register and connect to the rancher server

ssh into the host you have registered in rancher. do a docker ps -a | grep rancher
you should see a container named rancher-agent running. If not: Try to re-run the host registration.( First remove anything that previously rancher agent did rm -rf /var/lib/rancher/state; docker rm -fv rancher-agent; docker rm -fv rancher-agent-state)

then do the following.

$ docker exec -it rancher-agent bash
$ env

Note the environment variables. Now run he following command to see if the agent can connect to Rancher server API (it will use the environment variable you saw before).


You should get a 200 OK from rancher server with proper JSON return. This means that the agent can authenticate and connect to Rancher server.

See also

Thank you for your help! It led down a track that got me here which suggested it might be nginx in front of my Rancher server causing issues for websocket calls.

I somewhat blindly copied some extra config into my nginx configs (copied from here) and lo and behold, after restarting the nginx proxy, my host registered itself.

Thanks for your help!