Skip to content

Creating Docker Hosts on Azure with Docker Machine

Roberto Quintanilla edited this page Sep 26, 2016 · 5 revisions

Creating Docker Hosts on Microsoft Azure using Docker Machine

Almost ready

Also, while it's not required at all, you might still want to have the Azure CLI to check the names of the VM images you wish to use, as well as the VM sizes available:

brew update && brew install azure-cli

Ready?

You can check out all of the options available by running:

docker-machine create --driver azure

For now, I'll put here the command I use to create them. Notice that since I prefer using Debian Jessie instead of Ubuntu Server for my Docker Hosts, I'll set that option in this example:

docker-machine create \
 --driver azure \
 --azure-image "credativ:Debian:8:latest" \
 --azure-location "southcentralus" \
 --azure-resource-group "Icalia-Project" \
 --azure-size "Standard_D1_v2" \
 --azure-ssh-user "the_user_you_want_to_use" \
 --azure-subscription-id "000aaa0a-your-subs-crip-tionIDaa0a00a" \
 --engine-label "data-host=true" \
 my-docker-host-01
  • azure-image: The base image used for the VM - Get a list using Azure CLI: azure vm image list --location southcentralus --publisher credativ
  • azure-size: The size of your VM - Get a list using Azure CLI: azure vm sizes --location southcentralus
  • azure-subscription-id: The ID of the subscription you want to use to create the VM. You can check out your available subscription ID's using Azure CLI: azure account list

Docker commands in the host

Before attempting to issue docker commands inside the host (i.e. entering via SSH using docker-machine ssh my-docker-host), you'll need to add the ssh user of the machine you just created to the docker group.

If you followed the instructions (using the Debian Jessie VM Image), then you'll need to issue the following command right after you've created the host:

docker-machine ssh my-docker-host-01 sudo gpasswd -a ${USER} docker

Dude, where's my configuration???

If you followed this guide correctly, the configuration is not at /etc/defaults/docker...

...it's at /etc/systemd/system/docker.service, because it's using systemd (see custom-docker-daemon-options for Systemd)

What about swarm options on docker-machine?

Right now (version 0.8.1), they won't use the native swarm available on docker >= 1.12, so I don't use it at all.

Clone this wiki locally