Ramkumar Ramagopalan
Ramkumar Ramagopalan

Reputation: 69

Host not able to talk to Rancher server running as a docker container

All I am trying is to register my host with Rancher server but I get this 404 error.

RAMKUMARs-MBP:~ ramagopr$ sudo docker run -e CATTLE_AGENT_IP="52.62.40.106"  --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /private/var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.5 http://localhost:32772/v1/scripts/27E241A87324A765AEDE:1483142400000:mHM9ukEqCB0Pqd6MTv1lO7g3UE8

INFO: Running Agent Registration Process, CATTLE_URL=http://192.168.65.2:32772/v1
INFO: Attempting to connect to: http://192.168.65.2:32772/v1
ERROR: http://192.168.65.2:32772/v1 is not accessible (The requested URL returned error: 404 Not Found)
ERROR: http://192.168.65.2:32772/v1 is not accessible (The requested URL returned error: 404 Not Found)
ERROR: http://192.168.65.2:32772/v1 is not accessible (The requested URL returned error: 404 Not Found)

Upvotes: 1

Views: 1276

Answers (1)

Vincent Fiduccia
Vincent Fiduccia

Reputation: 999

Docker for Mac is not supported and does not work. The stuff it does to make it appear that ports are being published on "localhost" of your Mac instead of on the Moby virtual machine that is really running behind the scenes is cute but not compatible with the way CNI drivers manage networking (iptables rules on the actual host).

Separately, seeing the registration URL to "localhost" means the agent is talking to itself when it is expecting to reach the server container. The Moby VM does have a secret IP address and you can use that to register it as a host to itself, but publishing ports and communicating with other hosts is still not going to work.

If you want to use Rancher on a Mac effectively, you need to setupa regular VM with regular Docker in it. I use this script to automate it with xhyve: https://github.com/rancher/10acre-ranch/blob/master/README.md#docker-machine-on-macos

Upvotes: 1

Related Questions