Prerequisites for Eucalyptus Cloud

In order to get started, the Eucalyptus cloud needs to have an Ubuntu Raring Cloud Image bundled, uploaded and registered before the steps below can be followed. The previous blog entries below will help here:

After Vagrant and the vagrant aws plugin have been successfully installed, all that is left is to create a Vagrantfile to provide information to Vagrant as to how to interact with Eucalyptus. Since the vagrant aws plugin is being used, and Eucalyptus is compatible with AWS, the configuration will be very similar to AWS.

I provided a Vagrantfile on Github to help get users up to speed quicker. To check out the Vagrantfile, just clone the repository from Github:

Once the Vagrantfile is populated with the correct information, we are now ready to launch the Docker instance.

Launch the Docker Instance Using Vagrant

From here, Vagrant makes this very straight-forward. There are only two steps to launch the Docker instance.

Run the following command to launch the instance:

vagrant up --provider=aws

After Vagrant finishes deploying the instance, SSH into the instance:

vagrant ssh

Thats it! Once you are SSHed into the instance, to run Docker, execute the following command:

ubuntu@euca-172-17-120-212:~$ sudo docker

You have successfully launched a Docker instance on Eucalyptus using Vagrant. Since Eucalyptus works with the vagrant aws plugin, the same Vagrantfile can be used against AWS (of course, the values for the variables above will change). This is a perfect dev/test to production setup whether Eucalyptus is being used for dev/test and AWS being used for production (and vise versa).

If the –region option seems confusing, this is due to the fact that I am using the nice configuration file feature in Euca2ools. Its really helpful when you are using different credentials for different users.

Now that we know the EMI we can use, lets launch the instance. We will be using the cloud-init config file from my previous Docker blog to configure the instance. The VM type used here is c1.xlarge. This is because I wanted to make sure I had 2 CPU, and 2 Gigs of RAM for my instance:

Now we have a CentOS 6.5 base image. The mkimage-rinse.sh script can also be used to install CentOS 5 base images as well. Instead of passing centos-6, just pass centos-5. For example, I have created a CentOS 5 base image in this instance as well. Below shows the output of the images added to Docker:

As you can see, Docker helps developers test their software across multiple Linux distributions. With Eucalyptus (just as in AWS), users can use the ephemeral nature of instances to quickly stand up this test environment in one instance.

The focus of this blog entry is to show how to deploy Docker on Eucalyptus from a cloud administrator’s point-of-view – all in the cloud. This is a step-by-step guide to create an Docker EMI from an existing Ubuntu Cloud Raring EMI using AWS’s documentation. This entry will also show how to build euca2ools from source in the Ubuntu Cloud image.

Creating an EMI From an Existing EMI

As mentioned earlier, these steps will be based off of AWS’s documentation on creating an instance store-backed AMI from an existing AMI. In this example, here is an existing Ubuntu Raring instance thats running on Eucalyptus:

Before launching the EMI, the cloud-init configuration file needs to be created. This file will be responsible for configuring the instance repositories, downloading and installing Docker. With your favorite command-line editor, create a file called cloud-init-docker.config, with the following content:

Once the instance reaches running state, ssh into the instance using the keypair specified (which in this case will be euca-admin.priv), and execute the following Docker command to run an interactive shell session inside a minimal Ubuntu container: