Docker as a Service in vCAC Part 1

Once again I am here to prove that vCAC can integrate with anything. The new kid in town this week ; – ) is Docker Containers. In this example I am using CentOS Linux 6.5 with the vCAC guest agents installed to host Docker. This same example will work with RHEL 6.5 or newer versions of either OS.

dockernode

First off you will need to have a blueprint setup in vCAC that is mapped to a Linux template in vCenter that already has the the vCAC Linux Guest Agent for vCAC. For testing I also recommend to set this up as a linked clone. (Way faster!)

NOTE: Docker requires CentOS 6.6 or higher to work properly.
vCAC Linux Guest agent guide here
How to configure linked clone provisioning here

If you have not already done so you will need to setup the repo mount script so we can call shell scripts from an NFS server. This makes it very easy to modify this integration for other use cases without having to update the template.

Step 1: In your putty session create a new directory /repo

mkdir

Create a shell script named repomount.sh with the following and save it to the / directory ( you are creating a command to mount an NFS share that will take two variables as inputs.)

media_1405144747544.png
mount -t nfs $1:$2 /repo &>/repomount.log

Now make the file executable then shutdown your template VM.

media_1405099267474.png

Once shutdown, create a snapshot.

NOTE: if you are planning to use linked clone in vCAC or if this was mapped to a blueprint in vCAC already you will need to run inventory and update the blueprint.

Now we are going to create the install script on the NFS server that we will mount an NFS share from and execute a docker install script. In an exported NFS directory create a dockerinstall.sh file by typing vi dockerinstall.sh

media_1405105288699.png

Now enter the following lines (Copy and paste text below)

Dockerinstallsh
yum -y install epel-release
yum -y install docker-io
service docker start
chkconfig docker on

Press the ESC key, then Hold down Shift and press ZZ on the keyboard to save the file.

Now make the file executable

media_1405106020794.png
chmod 777 dockerinstall.sh

Now we need to create a build profile for the blueprint to install and configure docker with the script we created on the NFS share. Login to vCAC as an Administrator and create the following new build profile. Copy and paste below.

media_1405106947521.png
repo.path /scripts
repo.server 192.168.140.134
VirtualMachine.Admin.UseGuestAgent true
VirtualMachine.Customize.WaitComplete true
VirtualMachine.Software0.Name repomount.sh
VirtualMachine.Software0.ScriptPath /repomount.sh {repo.server} {repo.path}
VirtualMachine.Software1.Name dockerinstall.sh
VirtualMachine.Software1.ScriptPath /repo/dockerinstall.sh
VMware.VirtualCenter.OperatingSystem rhel6_64Guest

Now add this to the CentOS blueprint we configured earlier

media_1405107269217.jpg

Fire off a new request

media_1405107359662.jpg

Like my sexy icons? You can get them here in the newly updated Icon Pack.

Open your new Docker Node from the Items Tab and connect to an SSH session and login. See my guide to setup SSH in Firefox.

media_1405144321222.jpg

Type Docker at the command line and let the magic begin!!!

media_1405144526649.png

In Part 2 we will take this a step further and allow the requester to specify the docker image they want to deploy for even further automation.

Remember sharing is caring!

4 Replies to “Docker as a Service in vCAC Part 1”

  1. Pingback: Technology Short Take #43 - blog.scottlowe.org - The weblog of an IT pro specializing in virtualization, networking, cloud, servers, & Macs

  2. Hi,

    Great post!
    Hopefully you can spare some time soon to write down the how you managed to configure containers as a service.

    Keep up the good work.

    • Hi Lars,

      It is in the works. Had some ideas initially but as I learn more about docker I found a way to make it much more scalable. Stay tuned!

  3. Pingback: Docker as a Service in vRA/vCAC part 2 – InstallPullandRun | VMtoCloud.com

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.