You may have heard of vCloud Air -- formerly known as vCloud Hybrid Service -- VMware's first foray into the world...
of public cloud computing. Thanks to VMware's partnership with Docker, users can now create containers on vCloud Air, which has been a huge selling point for the software. In this article, we'll put VMware's cloud strategy to the test by learning how to set up a Docker host on vCloud Air.
The first step is, of course, to sign up for a vCloud Air account. It may take a while for your login details to be approved and delivered. In the invite, you will receive a login to the vCloud portal, which will prompt you to set a new login password.
There are many ways to interact with vCloud Air, including vSphere Web Client, an application programming interface or through direct interaction with the Web portal.
In this example, we will manage our vCloud instance using the Web-based portal VMware provides. VCloud Air is convenient because it allows you to launch a VM with Internet access in mere minutes, which means it's much easier to set up than AWS.
Once you've logged into the vCloud platform, you will see three options: Object Storage powered by Google Platform, Virtual Private Cloud OnDemand, and Identity and Access.
Select "Virtual Private Cloud OnDemand" and choose an appropriate physical data center in which you want to base your VMs.
You can import your own machines or create your own catalog items; you can even have machines in several data centers. In this tutorial, we'll be using the Docker-optimized VMware Photon OS, which I discussed in a previous article.
Implementing a basic Docker instance is incredibly simple. Select "Create your first virtual machine" from the Photon menu; this menu allows you to select a machine image to deploy. In my example, I chose "VMware Photon OS Tech Preview 2", then clicked continue. This menu also gives you the option to set up a Docker host using an Ubuntu host, but that process is more complex.
Once you've selected a machine image, you must choose a hostname -- I called mine "dockerhost." After selecting Photon, a quick tip is to select the "Customize my Guest OS."
Here you can set a root password to replace the automated one that is created for you -- after all, we aren't talking mass deployment here, just a bit of experimentation. Should you forget to do this, you can use the "Show password" hyperlink after the machine has been created.
As for resources, I recommend giving the cloud VM-based Docker host 4 GB of RAM and one CPU. Leave the 16 GB solid-state drive backed storage as it is. Deselect the option to power on the machine.
A Docker host would normally have more resources, but this virtual host is only an example of what is possible with a few Docker images. Creating the instance may take several minutes.
The next step is to configure the network settings for the VM. If you look at the network portion, you will notice you are allocated a /24private network. We are going to use Network Address Translation to allow many virtual guests to use the one IP address. IP addresses are an additional, albeit necessary, cost option. At this point, you'll need to get a private IP address and create firewall rules and gateways.
To obtain an IP address, click on the "Gateways" tab. This will open a new page. Click in the "VDCOne" tab and select "Public IPs". Now, from the "Actions" box, select the "Connect to the Internet" box. This sets up a default rule for us.
Lastly, click "Add IP address" and you should be able to power on the VM.
To open the console locally, select the box to highlight the VM in question and then click "Power On."
From the drop down actions box, you can select "Open Console" and, after logging into it, you will see the basic console.
Since Docker is already installed on Photon, all you need to do is enable and start it. This is done by logging into the console as root and issuing the following commands:
systemctl enable docker
systemctl start docker
If you type "docker info" you should see the following image:
You can now test the Docker infrastructure by downloading the Whalesay package to test. Whalesay is Docker's version of a "Hello World." Enter the following command:
docker pull docker/whalesay:latest
Next, enter this command to make Whalesay "speak":
docker run whalesay cowsay hello
If Docker is running properly, you should be able to see the image shown in Figure D.
Using the console is not always so straightforward. For that reason, I recommend enabling Secure Shell login and modifying the firewall to enable it to work.
This is a very rudimentary introduction to setting up a basic Docker instance on vCloud. The nice thing about this is you can build your application around Docker, Photon and vCloud with relatively little effort. We've only scratched the surface of what is possible, but in a future article we will look developing a more complicated application and working more on the management aspect of the system.
Docker won't replace the VM
VMware changes things up with vCloud
Docker and virtualization can work in harmony