Container Orchestration using Rancher

Orchestrating Docker containers using Rancher.

Imagem de capa

Rancher is an open source software platform that enables organizations to run and manage *Docker* and *Kubernetes/Swarm/Mesos* in production. With Rancher, organizations no longer have to build a container services platform from scratch using a distinct set of open source technologies. Rancher supplies the entire software stack needed to manage containers in production.

Rancher software consists of four major components:


In this tutorial, you'll get to know about Rancher Server Installation, Adding Custom Hosts to the Rancher Server, Creating Environments & much more!


  1. A Linux machine of any configuration with an access to Interne.
  2. Docker Installed on the same machine. (If you don’t know how to, visit HERE and install it.

Step 1 - Installing Rancher Server

    abc@xyz:~$docker --version
    Docker version 17.06.1-ce, build 874a737
    abc@xyz:~$docker run -d --restart=unless-stopped -p 8080:8080 rancher/server 


    abc@xyz:~$docker ps

    CONTAINER ID     IMAGE          STATUS            PORTS
    01c0d330c84d  rancher/server  Up 10 Mins>8080/tcp

Step 2 - Accessing Web UI of Rancher Server

The UI and API will be available on the exposed port 8080

Navigate to the following URL: http://<SERVER_IP>:8080

The SERVER_IP is the public IP address of the host that is running Rancher server. (In our case it will be localhost initially but later we will change it with an actual IP)


Step 3 - Setting Access Control 

You will see a warning icon next to the ADMIN menu item at the top of the screen. If you hover over this link, you'll see the message Access Control is not configured.


Access Control is how Rancher limits the users who have the access permissions to your Rancher instance. By default, Access Control is not configured. This means anyone who has the IP address of your Rancher instance will be able to use it and access the API. Your Rancher instance is open to the public!

There are many ways to set Access Control, for now, we will use a Local account.


That's it! Local Authentication will now be enabled with your newly created User.

Step 4 - Adding new Host

For this post, we will be creating a host on the same machine where Rancher Server resides. Practically, you will rarely have such situation.

        abc@xyz:~$docker exec -it CONTAINER_NAME /bin/bash
        root@YOUR_CONTAINER_ID:/# ifconfig




abc@xyz:~$sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock \
\ -v /var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.6 \ 
INFO: Running Agent Registration Process, CATTLE_URL=
INFO: Attempting to connect to:
INFO: is accessible
INFO: Inspecting host capabilities
INFO: Boot2Docker: false
INFO: Host writable: true
INFO: Token: xxxxxxxx
INFO: Running registration
INFO: Printing Environment
INFO: ENV: CATTLE_HOME=/var/lib/cattle
INFO: ENV: RANCHER_AGENT_IMAGE=rancher/agent:v1.2.6
INFO: Launched Rancher Agent: 8f5ce937fff4c179f26e64aea0887f40839f2d201581f66bf76009ae84c71477


Step 5 - Monitoring your Hosts

Once your host is added and is Active, you can click on the name of the host to open up the Monitoring window.


Here, you can view CPU utilization, memory consumption, Storage, Network details of that host. Also, you can see the containers that are running on that particular host.

If you see that you are using most of the memory or if your CPU is running continuously hot, you may want to launch more nodes to reduce container density and spread out the load. You can react quickly to load spikes by provisioning more compute nodes right from Rancher's UI.

Once the spikes abate, you can shut down any additional nodes by visiting the Hosts page, locating your host, and clicking the Deactivate icon (the box with two vertical lines, as shown in the following figure:


Step 6 - Adding Services from Catalog

Being the leader, Rancher provides tons of Service integrations that you can use to install them on your hosts. To access them, go to Catalog > All

Here, you can see the list of services currently available for you to use. You can click on View Details to check them out & modify the options for Installation.



This article was meant for the basic introduction of Rancher. You now know how to launch, monitor, and deactivate compute nodes using Rancher. You can explore it further on your own by getting your hands dirty!

You're more than welcome to share this blog post with your friends/colleagues if you think they might benefit from it!