Last week I had to provision a Docker host and I tried out the docker-machine command. The resulting host would have to use an existing Azure subnet from another resource group and I also needed to be able to reach the machine using it’s private IP.

After reading the docs and playing for some minutes I came up with the correct command to use Docker Machine with an existing Azure VNET:

1    docker-machine create --driver azure --azure-subscription-id [subscriptionid]  `
2       --azure-resource-group [Resource group] --azure-location [Azure location]  `
3       --azure-vnet [Resource group]:[Azure VNET] --azure-subnet [Azure Subnet Name]  `
4       --azure-subnet-prefix [Azure subnet prefix (CIDR notation)] --azure-use-private-ip [machine name]

Hope it helps!