Home - GunSik2/rancher GitHub Wiki

Sub projects

  • Rancher is a complete platform for operating Docker in production.
  • RancherOS is a 20mb Linux distro that runs the entire OS as Docker containers
  • Convoy is Docker storage driver for backup and recovery of Docker volumes

Rancher

Launching management server with Vagrant

git clone https://github.com/rancher/rancher
vagrant up

Launching management server manually

docker run -d --restart=always -p 8080:8080 rancher/server

Add Hosts

  • go to UI (eg. http://172.19.8.100:8080).
  • go to Infrastructure > Hosts, and click Add Host.
  • copy a command to use to add hosts, and edit command and insert "-e CATTLE_AGENT_IP=<server_ip>"
docker run -e CATTLE_AGENT_IP=172.19.8.3 -d --privileged -v /var/run/docker.sock:/var/run/docker.sock rancher/agent:v0.8.2 http://172.19.8.100:8080/v1/scripts/1A009C4AA50B75158D5D:1446742800000:Vd9dCcRD64laYPibNxlrWGkyFHE

Create Containers through UI

  • In the newly added host, click +Add Container

Create Containers through Docker CLI

docker run -it --name=app3 ubuntu:14.04.2  # docker daemon assigned ip
docker run -it --label io.rancher.container.network=true  --name=app4 ubuntu:14.04.2 # Rancher’s overlay network

Create a Multi-Container Application through UI

  • LB -> WordPress -> MySQL
  • UI > Applications > Get Started page
    • Add Service -> database -> Advanced option -> MYSQL_ROOT_PASSWORD=pass1
    • Add Service -> mywordpress -> Addd database service in Service Links
    • Add Service -> Add Load Balancer -> Set target port
  • Open web browser and check "host_IP:public_port"

Create a Multi-Container Application through CLI

  • UI > Stacks > Export Config : download docker-compose.yml and rancher-compose.yml
  • Applications > Stacks : download rancher-composer located on the the upper right corner page
  • Settings > API & Keys : click "Add API Key" and save it
  • Set up environment variables
$ export RANCHER_URL=http://server_ip:8080/
$ export RANCHER_ACCESS_KEY=<username_of_key>
$ export RANCHER_SECRET_KEY=<password_of_key>
  • Run command in the directory saved docker-compose.yml and rancher-compose.yml
rancher-compose -p NewWordpress up

RancherOS

Running RancherOS

git clone https://github.com/rancher/os-vagrant
cd os-vagrant
vagrant up
vagrant ssh

Upgrade

docker ps
sudo system-docker ps
sudo ranchectl -v
sudo ranchectl os list
sudo ranchectl os upgrade

Downgrade

sudo ranchectl -v
sudo ranchectl os list
sudo ranchectl os upgrade -i rancher/os:v0.7.0

Convoy

Backup

sudo docker run -it -v vol1:/vol1 --volume-driver=convoy ubuntu
# touch /vol1/foo
# exit
sudo convoy snapshot create vol1 --name snap1
sudo convoy backup create snap1 --dest s3://convoy-demo@us-west-2/

Restore

sudo convoy create vol1 --backup s3://convoy-demo@us-west-2/?backup=7a07c344-...-2898604baad3
sudo docker run -it -v vol1:/vol1 --volume-driver=convoy ubuntu
# ls /vol1/foo
⚠️ **GitHub.com Fallback** ⚠️