Rancher: Multiple hosts in the same physical machine

1.1k views Asked by At

I'm getting in habit with rancher and docker and I'm now trying to figure out if it is possible to create multiple local custom hosts on the same physical machine. I'm running RancherOS in a local computer. Through the Rancher Web UI I'm able to create a local custom host and add containers to it. When I try to add another local custom host copying the given command to the terminal (SSH into the rancher machine) it stars the process but nothing happen. The new host doesn't appear in the hosts list of the web interface and I don't receive any error from the terminal.

I couldn't get any useful information from the Rancher documentation about this possible issue.

I was wondering if it's not possible to have more than one custom virtual host on the same physical machine or if the command fails for some reason that I would like to know how to debug.

sudo docker run -e -d --privileged \ -v /var/run/docker.sock:/var/run/docker.sock rancher/agent:v0.8.2 \ http://192.168.1.150:8080/v1/projects/1a5/scripts/<registrationToken>

where registrationToken is replaced by the one provided by rancher.

2

There are 2 answers

1
Vincent Fiduccia On BEST ANSWER

There is nothing "virtual" about them. The agent talks to docker and manages one docker daemon, which is the entire machine. Running multiple does not make sense for a variety of reasons, such as when you type "docker run ..." on the machine, which agent is supposed to pick up that container? And they are not really isolated from each other regardless, because any of them can run privileged containers which can then do whatever they want that affects the others.

The only way to do what you're asking is to have actual virtual machines running on the physical machine, each with their own OS and docker daemon.

0
Michael Wyraz On

Another option might be to use linux containers to create separated environments, each having it's own ip address and running it's own docker daemon.