Rancher Part 4:  Using the Catalog Example with GlusterFS

As promised, it’s time to get to the catalog goodness. Since GlusterFS hasn’t gotten enough love from me lately, it’s time to bring that into the process as part of my Rancher demo. The goal with this exercise is to spin up a GlusterFS environment and to expand it using the built-in capabilities provided by the catalog.

Deploying an Application from the Rancher Catalog

Go to the Applications menu option and select Catalog from the secondary menu. That will bring you to the built-in application catalog screen:


There are a neat array of applications to choose from which target a number of typical core services. In the left hand pane, you can see that they can be searched and sorted by category. The default shows the full list.

We want to try out a GlusterFS demo because it will show us how a multi-container stack is deployed, plus we get to expand it as well using the Rancher UI. Find the GlusterFS link in the catalog and click the Launch button:


We have a few options available as you would expect. We can choose the name of the stack, a free-form description text field, and also the


What’s even cooler is that you can expand the Preview link to expand the window. This will give us the two YML files that could be used from the command line interface to create this same cluster:


You can see the contents of the sample YML files here for each of the docker-compose and rancher-compose that I’ve copied out to GitHub gists for better viewing:

Docker Compose: https://gist.github.com/discoposse/4cb03c3abfa60d1d9a40

Rancher Compose: https://gist.github.com/discoposse/2f7c1a24aca645a93567

Once you complete the wizard, the GlusterFS stack will spin up and you will see the results within a couple of minutes”


You can look at your running stack by clicking on the name in the Stacks view. This will bring up the screen showing some details about the application, commands, status, and also the containers further down the page.


Yes, it is just that easy.


Scaling up the GlusterFS Cluster in Rancher

Now that we have our GlusterFS environment running, we can expand it by a couple of nodes to illustrate how easy it is to scale the application.

In the Stacks view, you simply click the +Scale Up button


As you wait and watch, the view will update showing the network address, and container status. Once completed, it will look something like this:


You can do it again to show just how easy it is to add another node:


To confirm that the application itself has recognized the new nodes, let’s spark up a terminal shell and see how the health of the GlusterFS cluster is. You can do this easily by hovering on the container in the view and the clicking the context menu which brings up the Execute Shell option:



We can use the glusterfs pool list which will tell us which servers are actively attached to the GlusterFS pool. As you can see from the example here, there are 5 nodes in the pool:


To manage the scale level, including reducing the scale manually, you can use the + and – buttons that appear in the Stack details view:


Was that both fun and easy? Why, yes it was.


Join us in our upcoming 5th post in the series as we explore the advanced container configuration options. This is a great opportunity to explore core Docker concepts as well, so put on your thinking caps for that one!

Rancher Part 3:  Adding the DockerHub to our Rancher Registry

So far in the series, we’ve covered installing your Rancher instance on Ubuntu, and attaching Rancher to the Docker host on Ubuntu. Next up we want to be able to stretch our wings a bit and add some other container images.

Rather than downloading the images individually and having to then work from a local instance, Rancher allows us to connect to an external registry which can be the DockerHub, Quay.io, or a custom registry which could include private Docker hub instance.

Adding Docker Hub as a Registry in Rancher

In the upper right corner, you will see your user icon. Click the down arrow which will bring up the menu, and select the Registries option:


In your Registries screen, click the Add Registry button:


You can see that the default setting button in our case is the DockerHub, and you could select others as well, but for now let’s start with the public DockerHub. You’ll need a DockerHub account which you can get by registering at https://hub.docker.com. Use the same credentials to add the DockerHub registry in Rancher:


That will bring you to the Registries screen again and you’ll see DockerHub with the state as Active:


That’s the first part of the fun, so let’s up our game and add a container in Rancher straight from DockerHub.

Using DockerHub Images with Rancher

Let’s start by going to https://hub.docker.com/ and logging in. This will be helpful as we pick which container images to try out:


As it turns out, I happen to have a test image already stored in my repository called discoposse/apache-test which is a good place to start:


In your Rancher UI, click the Infrastructure top menu and then the Containers link on the secondary menu, then click the Add Container button:


The Name and Description options are free form text. For the sample, I’m calling this Apache Test, and the description can be anything you want. Under the Select Image field, you have to type the same name that appeared in the DockerHub in the form of [username]/ but sometimes you may find some that are also “official” images that won’t have a username at all.

The example for us is discoposse/apache-test as shown here:


In the Hosts view you will see the container as it is being added:


Once it’s completed, you can click the name to bring up the detailed view:


That’s one example which gives you an idea on a user-configured container that has been uploaded to repository. Let’s also grab another image from one of the official images that we find in the DockerHub.

I’m a fan of nginx, so that’s a great place to start. In the DockerHub, use the search field to find nginx which will bring up a number of results. At the top of the list will be the official nginx image provided by, yup you guessed it, nginx:


Back in Rancher, go to the Containers view under Infrastructure and click the Add Container button to create our nginx container. Again, the name and description fields are free form which you can fill in as you wish, but for the Select Image field, type in nginx:


Under the Containers view you will see our list of active containers that includes both the Apache test and our freshly launched nginx instance:


Click on the nginx-01 name, or whatever you happened to have named yours, and this will bring up the detailed view:


This is a great way to extend our Rancher capabilities to allow anyone using the system to launch containers directly from the public repositories. All with a few simple steps.

What’s Next?

Now that we have a DockerHub registry, a running Docker host, and a basic understanding of how to launch containers from the local images as well as from the DockerHub, it’s time to start using the Catalog view next. We can then get into building out some more examples using pre-built applications from the catalog in Part 4, and then begin to do advanced container configuration in Part 5.

Rancher Part 2:  Adding a Docker Host to Rancher

Now that we’ve gotten Rancher up and running from our first post, it’s time to take the next steps and configure our first host. We are going to run Rancher pointing to the same host that we are running Rancher on. That may seem like some sort of Docker inception thing, and definitely not the recommended way to run in production, but it’s a great way to test the waters on how it will work.

Adding your First Custom Host in Rancher

Using the Rancher UI, we can add hosts by clicking on the Infrastructure menu which brings you to the Hosts view. We will select the Add Host option and in the dialog, make sure to click the Custom provider at the top.


The instructions for adding our custom host are neatly laid out for us on the page, so our next step is to jump to number 4 on the list. Highlight and copy the code on the instructions page which we will paste into the console of our host:


That command will pull the Rancher agent container and spawn it onto the host to connect it to our Rancher environment for us. After a few moments, you will see the RancherDemo (or whatever your demo machine is named) appear in the Hosts view.


Now that we’ve added our host, we can see that there is already a standalone container running that has been detected. It’s our Rancher UI container running on the RancherDemo host. As you can imagine, it’s not a good idea to mess around with that one, so we will move on to test out Rancher in a few other neat ways.

Time to get started with some more Rancher goodness. The first thing we will do is to create a new container on the host to test that workflow out. Using the Hosts view, click the Add Container section:


This will bring up the new container dialog with some options we can apply to our container. We will start in the shallow end of the pool and work our way up. Let’s just name the container and pick the ubuntu:14.04.3 container in the Select Image option. There will be only one image to choose from because we used the Ubuntu image to build our initial Rancher container.


There are a number of other advanced options, but we will explore that later on in another post. Now we will be put back to our Hosts view and you will see the container build. As the first container is built, another container will also appear called Network Agent. This is the networking container that sets up the container networking including routing and DHCP options.


You can click the Ubuntu-demo container in the Hosts view and it will bring you to the details pane with a number of charts showing IP address information, and some performance statistics in the active graphs.


In the upper right area of the details page, you can click the icon next to the state display, in this case where it says Running:


The options here include the control options to start, stop, delete, and also to clone, view logs, and view in the API screen. For our quick example, let’s select the Execute Shell:


This brings up the console of our container, in this case running Ubuntu server and logged in with root privileges:


You have complete operational access just as if you had a full virtual machine.  This isn’t really news, but it’s still pretty cool when you run apt-get inside a container that took a few seconds to launch:


Next we will close the shell and go to the Containers view on the Infrastructure tab. This is where we see the containers on our Rancher environment with details including container state (running, stopped), the container name, IP address, image name, and also any active command that is running.


Click on the RancherDemo container name which will bring you to the details view for that container. As you can see, there is more information here:


The Docker details appear in the Info box, and because it’s a Docker host, you can see the list of containers at the bottom of the details view. This is a handy way to navigate around the UI because each entity has details and drill-down capability based on the context of that entity.

Thinking at the Application Layer

The joy of moving up the stack is that Rancher lets you see multiple layers, and to build out applications within your container environment. Remember that the whole purpose of all of this infrastructure is to enable the rapid deployment and simpler administration of applications.

By clicking on the Applications menu at the top, and then the Catalog view in the secondary menu, you can see the Application Catalog that comes baked in with Rancher:


I know that your eager to keep going, but that’s the end of this post. If you want to click around the interface, I would recommend that. It’s good to be familiar with the various options, but don’t worry, we will also walk through lots of the features and views in the upcoming posts in this series.

What’s Next?

We have a limited number of containers and applications, so the next thing we will do is to connect the Rancher environment to the DockerHub to be able to pull down some other images and extend our testing a little bit.