Deploying a Docker Sandbox using Vagrant and VirtualBox

Even with the addition of more client-side tools for running Docker, it still requires installing development tools that may impact your local environment. Plus, I’m a fan of using VirtualBox to make sandbox environments that I can spin up and tear down as needed. This means that I never have to worry about version conflicts with development languages and dealing with package management on my Macbook or on my Windows machine. Every machine will use the same recipe.

Deploying the VirtualBox Docker Sandbox Environment

We are assuming you’ve read the initial post, you have already installed Vagrant, VirtualBox and Git. Once you are up to that point and ready to go, we just need to pull down the code to deploy our Docker sandbox using git clone first:


Next, change directory into the folder cd virtualbox-docker-sandbox and then run the vagrant up command:


That’s going to run for a while, and you will see after about 10 minutes that you’re back at the prompt. Now we can use vagrant ssh dockersandbox to get onto the console and confirm our environment:


You’ve got the nested instance running, and as you may have read in the file from the code we cloned, we have installed docker as well as docker-compose and docker-machine which will help us test the waters on a few different Docker features:


Now you can start up some Docker containers without having touched your local machine at all, and this ensures a clean sandbox deployment for you that is able to be quiesced using the vagrant suspend dockersandbox command:


To bring the environment back up, just run a vagrant resume dockersandbox

Running Docker as Sudo

One thing to note is that we have deployed the Docker runtime as sudo, and because of that we must always run the Docker commands as sudo. This is a best practice in general, so when you try to run docker pull or any docker commands, you will see errors about the daemon not being available:


Run the sudo docker pull nginx instead of docker pull nginx and you will see a marked difference in the results:


Happy Dockering!

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:

Rancher Compose:

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!