Add host and Rancher agent

I am new to Rancher. I had it working great on a Virtualbox machine running Ubuntu 14.04 with Docker. I accidently filled the harddrive and the virtual machnie stopped working. So I started over with a new virutal machine with Ubuntu 14.04 and Docker.

I ran:
sudo docker run -d --restart=unless-stopped -p 8080:8080 rancher/server
and Rancher works fine at this address:

When I try to run the agent command, it does not work, and I cannot add a host.

I have spent a whole day trying all kinds of ip addresses and variations to the command. I noticed that it is a different command on your site at:

than the command that shows up in Rancher. The Rancher command puts quotes around the ip address and also does uses the ip in the second location of the command.

Anty help you can give for me to get the agent running and to add a host would be much appreciated

here is my ifconfig info:

docker0 Link encap:Ethernet HWaddr 02:42:9d:b6:66:60
inet addr: Bcast: Mask:
inet6 addr: fe80::42:9dff:feb6:6660/64 Scope:Link
RX packets:6822 errors:0 dropped:0 overruns:0 frame:0
TX packets:6815 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1501909 (1.5 MB) TX bytes:4306845 (4.3 MB)

eth0 Link encap:Ethernet HWaddr 08:00:27:d4:b1:41
inet addr: Bcast: Mask:
inet6 addr: fe80::a00:27ff:fed4:b141/64 Scope:Link
RX packets:1020745 errors:0 dropped:0 overruns:0 frame:0
TX packets:478865 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:839220993 (839.2 MB) TX bytes:31225201 (31.2 MB)

lo Link encap:Local Loopback
inet addr: Mask:
inet6 addr: ::1/128 Scope:Host
RX packets:10739 errors:0 dropped:0 overruns:0 frame:0
TX packets:10739 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2093261 (2.0 MB) TX bytes:2093261 (2.0 MB)

Are you trying to run the agent on the same host/VM as the server container?

Yes, I am running the agent and host on same VM as the server containers

I think you need to pass the environment variable CATTLE_AGENT_IP to your rancher agent container in this case. The IP needs to be your machine’s IP, not the docker bridge or anything like that.

It is really strange. The first time I set up Rancher last week it was very easy. I am not sure what might have changed.

Here is the code generated by Rancher:

sudo docker run -e CATTLE_AGENT_IP=“” -d --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.0.2 is the IP of my machine

I have tried several variations of it with many different IP addresses.

I also tried this:

docker run -e CATTLE_AGENT_IP= -d --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.0.2

@markwebwyatt Just to note, it looks like your last attempt had 8088 instead of 8080 as the port exposed for Rancher. But it should be 8080.

Have you looked at the FAQs?

I finally got my original VM to run and Rancher works fine. It is version 1.1.3 and it is running on eth0 IP which is

on my new VM I am running Rancher Server Version 1.1.4
When I run this command:
docker run -d --restart=always -p 8080:8080 rancher/server
It runs on lo IP address by default whcih is

How do I run rancher server on my eth0 IP instead of lo ip?

I solved the issue. I installed Rancher Server Version 1.1.3 and it worked the first time. I was able to add a host by using the code:

sudo docker run -d --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.0.2

Rancher Server Version 1.1.4 does something different than V1.1.3.
V1.1.4 uses a different IP on my machine. And also will not allow me to add a host.