Rancher is an open source software that helps you to run the containers in production. With rancher, you no need to build containers from scratch; it supplies entire software stack needed to manage container.

Components:

INFRASTRUCTURE ORCHESTRATION: It is nothing but a computing resource (Linux Hosts), could be a virtual machine or physical machine.

CONTAINER ORCHESTRATION AND SCHEDULING: Container orchestration is a tool by which you can integrate and scale the containers in enterprise production. These tools are mainly aimed to simplify the container management and provide a framework for managing the multiple containers as one entity (it is nothing but a Docker cluster). Rancher includes those tools such as Docker sworm, Kubernetes, and Mesos.

APPLICATION CATALOG: With Rancher, an entire multi-container clustered application from the application catalog with one click of a button. Rancher maintains a public catalog consisting of popular applications contributed by the Rancher community.

If you are not able to access the Rancher, go through the rancher logs.

# docker logs -f

Replace the containerid with the output of “docker ps”

Working with Rancher:

Add host:

Since we are doing a single host Rancher installation, we will add the same host running the Rancher server as a host into Rancher UI. In the production environment, we recommend using the dedicated compute host for running the Rancher Server.

Go to Infrastructure –> Add Hosts

Rancher – Your Private Container Service – Add Hosts

If you are doing for the first time, Rancher will prompt you to select an IP address and it must be reachable to all hosts that you will be adding.

If your host is running behind NAT firewall or load balancer, Rancher will print a warning; you can ignore these warning as we will be adding Rancher server host itself.

Just click Save.

Rancher – Your Private Container Service -Select an IP

Rancher will take you to next page where you will be presented with cloud providers. Since we will be adding the host that is running Rancher server, we will select the “custom” option. Once you selected the custom option, Rancher will provide a command to use to add hosts.

Enter the public IP address of the host in the text box provided in the 4th step, now copy the whole command provided in the 5th step and run it on the Rancher host.

Rancher – Your Private Container Service – Custom

Once the command is executed, click close on the Rancher UI. Wait for a while; the host will be soon visible in Infrastructure –> Hosts page.

Rancher – Your Private Container Service – Hosts

Getting Started with First Container:

On Host Page, click on Add + Add container; Rancher will take you to Add container page where we will create our first container.

Just name your container like Ubuntu, Type the name of the image you wish to run as a container. For ex: ubuntu:latest and then click on Create

Rancher – Your Private Container Service – Create Our First Container

You will now see that creation of Ubuntu container is in progress. It will hardly take a minute, but, it depends on internet connectivity if the image needs to be pulled from Docker registry.

Managing Docker Containers:

Once the container is created, the container will start on its own. You can see the state as running with all details such as host, IP address, and command. You can see the performance of the container by clicking on Infrastructure —> Containers –> <container name>.

Rancher – Your Private Container Service – Container-Performance

With Rancher, you can also perform admin tasks such as stop, start, clone, restart, and able take the shell of a container.

Rancher – Your Private Container Service – Administrative Tasks

You can also take the console of the container just from the Rancher UI.

Rancher – Your Private Container Service – Shell Access

Rancher not only manages containers that are created by own; it can also manage that are created with native Docker commands.

For example, let’s create a CentOS container using the Docker command.

$ docker run -it centos

Once it is created, you can go to Rancher UI and see the status of the container.

Rancher – Your Private Container Service – Native-Docker CLI

That’s All for now. Stay Tuned for next article on Deploying Multi-Container Application using Rancher.