Creating Docker Hosts in Azure w/Docker-Machine 0.7.0

Last week, Docker released version 0.7.0 of Docker-Machine.  You can get the latest docker-machine with Docker Toolbox or Docker for Windows beta.

Among many new features, Azure users will find the new Azure driver extremely helpful. In previous versions, developers would need to create management certs and upload them to Azure. Configure firewall ports manually, and the VM was created using the RDFE APIs which meant it showed up as a “classic” VM. Apparently, classic is becoming the old/dated demarcation.

With 0.7.0, you can now use the following command:

On Windows, open a PowerShell prompt, set the subscription ID, then call docker-machine with the azure driver. Note the case sensitivity. It must be azure, not Azure. 
$env:AZURE_SUBSCRIPTION_ID = "Your subscription ID"

docker-machine create -d azure --azure-open-port 80 --azure-open-port 8000-8200 yourhostname

You can pass the subscription ID as a parameter as well, but unless your editing the text in a text editor, it can be a bit of a pain to construct the command.

Notice you can open the firewall ports, including a range. You can also set –azure-location and the –azure-resource-group name as well as many other options.

You can get the list of available options using:

docker-machine create -d azure --help

Or, simply review the Docker-Machine docs

A big thanks to Ahmet Alp Balkan who wrote the updated driver.