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.
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!)
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
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.)
mount -t nfs $1:$2 /repo &>/repomount.log
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
Now enter the following lines (Copy and paste text below)
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 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.
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
Pingback: Technology Short Take #43 - blog.scottlowe.org - The weblog of an IT pro specializing in virtualization, networking, cloud, servers, & Macs
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!
Pingback: Docker as a Service in vRA/vCAC part 2 – InstallPullandRun | VMtoCloud.com