Azure VM with Docker failing to connect
I’m trying to write a Powershell script to create a VM in Azure with Docker installed. From everything I’ve read, I should be able to do the following:
$image = "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_3-LTS-amd64-server-20150908-en-us-30GB" azure vm docker create -e 22 -l 'North Europe' --docker-cert-dir dockercert --vm-size Small <myvmname> $image $userName $password docker --tls -H tcp://<myvmname>.cloudapp.net:4243 info
The vm creation works, however the docker command fails with the following error:
An error occurred trying to connect: Get https://myvmname.cloudapp.net:4243/v1.20/info: dial tcp 220.127.116.11:4243: ConnectEx tcp: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Some articles I’ve found refer to port 2376 – but that doesn’t work either.
Logging onto Azure portal and viewing the created VM – the Docker VM Extension doesn’t seem to have been added and there’s no endpoints other than the default SSH one. I was expecting these to have been created by the
azure vm docker create command. Although I could be wrong with that bit.
A couple of example article I’ve looked at are here:
However, there’s plenty of other articles saying the same thing.
Does anyone know what I’m doing wrong?
2 Solutions collect form web for “Azure VM with Docker failing to connect”
I know you are doing nothing wrong. My azurecli-dockerhost connection had been working for months and failed recently. I re-created my docker host using “azure vm docker create” but it does not work any more.
I believe it is a bug that the azure-docker team has to fix.
For the time being, my solution is to:
1) Launch a Ubuntu VM WITHOUT using the Azure docker extension
2) SSH into the VM and install docker with these lines:
sudo su; apt-get -y update apt-get install linux-image-extra-$(uname -r) modprobe aufs curl -sSL https://get.docker.com/ | sh
3) Run docker within this VM directly without relying on a “client” and in particular the azure cli.
If you insist on using the docker client approach, my alternative suggestion would be to update your azure-cli and try ‘azure vm docker create’ again. Let me know how it goes.
sudo su apt-get update; apt-get -y install nodejs-legacy; apt-get -y install npm; npm install azure-cli --global
To add an additional answer to my question, it turns out you can do the same using the
docker create command …
docker-machine create $vmname --driver azure --azure-publish-settings-file MySubscription.publishsettings
This method works for me.