Code to create a Docker + Rancher + Cattle cluster with Ansible and Terraform
C# HCL JavaScript
Latest commit d26d907 Jan 20, 2017 @johnculviner committed on GitHub Update

Intro to Docker and clustering with Rancher from scratch


  • Aids in setup of Docker + Rancher on Digital Ocean with Terraform.
  • Also contains a variety of different language API examples that demonstrate how the Rancher/HAProxy load balancer works:


  • Create a DigitalOcean account
  • Create an API token
  • set an environment variable for the token
  • Install terraform
  • Make sure you have a ~/.ssh/id_rsa. If you don't run ssh-keygen with default options from ~/.ssh/
  • To create your VMs, from ./terraform run
terraform apply
  • Update ./ansible/inventory.ini for the IPs of your new VMs
  • Install ansible
  • From ./ansible run
ansible-playbook install-docker-rancher.yml
  • Visit http://IP_OF_YOUR_DOCKER_0_BOX:8080/ Infrastructure > Add Hosts
  • Run
ansible all -u root -a "COMMAND_RANCHER_GIVES_YOU"


You should now have a 4 node Rancher + Cattle + Docker cluster going that you can run containers on