docker build fails on a cloud VM docker build fails on a cloud VM docker docker

docker build fails on a cloud VM


Another approach would be to try letting docker-machine provision the VM for you and see if that works. There is a provider for Azure, so you should be able to set your subscription id on a local Docker client (Windows or Linux) and follow the instructions to get a new VM provisioned with Docker and it will also setup your local environment variables to communicate with the Docker VM instance remotely. After it is setup running docker ps or docker run locally would run the commands as if you were running them on the VM. Example:

#Name at end should be all lower case or it will fail.docker-machine create --driver azure --azure-subscription-id <omitted> --azure-image canonical:ubuntuserver:16.04.0-LTS:16.04.201608150 --azure-size Standard_A0 azureubuntu#Partial output, see docker-machine resource group in Azure portalRunning pre-create checks...(azureubuntu) Completed machine pre-create checks.Creating machine...(azureubuntu) Querying existing resource group.  name="docker-machine"(azureubuntu) Resource group "docker-machine" already exists.(azureubuntu) Configuring availability set.  name="docker-machine"(azureubuntu) Configuring network security group.  location="westus" name="azureubuntu-firewall"(azureubuntu) Querying if virtual network already exists.  name="docker-machine-vnet" location="westus"(azureubuntu) Configuring subnet.  vnet="docker-machine-vnet" cidr="192.168.0.0/16" name="docker-machine"(azureubuntu) Creating public IP address.  name="azureubuntu-ip" static=false(azureubuntu) Creating network interface.  name="azureubuntu-nic"(azureubuntu) Creating virtual machine.  osImage="canonical:ubuntuserver:16.04.0-LTS:16.04.201608150" name="azureubuntu" location="westus" size="Standard_A0" username="docker-user"Waiting for machine to be running, this may take a few minutes...Detecting operating system of created instance...Waiting for SSH to be available...Detecting the provisioner...Provisioning with ubuntu(systemd)...Installing Docker...Copying certs to the local machine directory...Copying certs to the remote machine...Setting Docker configuration on the remote daemon...Checking connection to Docker...Docker is up and running!To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: docker-machine env azureubuntu#Set environment using PowerShell (or login to the new VM) and see containers on remote hostdocker-machine env azureubuntu | Invoke-Expressiondocker infodocker network inspect bridge#Build a local docker project using the remote VMdocker build MyProjectdocker images#To clean up the Azure resources for a machine (you can create multiple, also check docker-machine resource group in Azure portal)docker-machine rm azureubuntu

Best I can tell that is working fine. I was able to build a debian:wheezy DockerFile that uses apt-get on the Azure VM without any issues. This should allow the containers to run using the default bridged network as well instead of the host network.


According to I can't get Docker containers to access the internet? using sudo systemctl restart docker might help, or enable net.ipv4.ip_forward = 1 or disable the firewall.

Also you may need to update the dns servers in /etc/resolv.conf on the VM