Skip to content

Instantly share code, notes, and snippets.

@vincent99
Created May 24, 2016 18:57
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vincent99/656b799a384d64ca8c5362543d4986d5 to your computer and use it in GitHub Desktop.
Save vincent99/656b799a384d64ca8c5362543d4986d5 to your computer and use it in GitHub Desktop.
Rancher on docker-for-mac with xhyve

Install Docker for Mac (http://beta.docker.com)

Install docker-machine-driver-xhyve (https://github.com/zchee/docker-machine-driver-xhyve)

brew install docker-machine-driver-xhyve sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve

Deploy the latest release

docker run -d --privileged -p 8080:8080 --name=rancher-server rancher/server:latest

or a build-master

docker run -d --privileged -p 8080:8080 --name=build-master rancher/build-master:latest

Create some hosts (set the host name in both places at the end)

docker-machine create --driver=xhyve --xhyve-memory-size='512' --xhyve-boot-cmd='loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 base host=host1' host1 docker-machine create --driver=xhyve --xhyve-memory-size='512' --xhyve-boot-cmd='loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 base host=host2' host2 docker-machine create --driver=xhyve --xhyve-memory-size='512' --xhyve-boot-cmd='loglevel=3 user=docker console=ttyS0 console=tty0 noembed nomodeset norestore waitusb=10 base host=host3' host3

Go to http://localhost:8080 once server is up, Add Host

Set host-registration URL to 192.168.64.1:8080

Fill in the version and URL from the command the UI shows, but run this to register each host instead:

docker-machine ssh host1 sudo docker run -e CATTLE_AGENT_IP=$(ifconfig eth0 | grep "inet " | awk -F'[: ]+' '{ print $4 }') -d --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker/rancher:/var/lib/rancher rancher/agent:##VERSION## ##URL##

Rinse, lather, repeat for host2...N

@lavaxun
Copy link

lavaxun commented Jul 31, 2016

I've formatted the REAME.md. feel free to update it
https://gist.github.com/axnux/09dc375d71398cbbee44ebd23ba35a08

@jaredallard
Copy link

I've attempted to do this, but the machines are unable to contact the server :(

@ribukshin
Copy link

Replacing localhost with IP worked for me.

@teemuniiranen
Copy link

Works perfectly but is there a way to bridge the network between docker-machine and host mac? I need to access private docker repository via host machine VPN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment