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> info

The vm creation works, however the docker command fails with the following error:

  • Azure ip address refused for docker
  • Mounting Azure File Storage in Docker container via Kubernetes
  • Ports On Docker
  • Accessing docker container over https on Azure subdomain
  • How to run docker-compose in Azure Container Service and deploy to agent rather than master?
  • Neo4j HA model don't work in docker
  • An error occurred trying to connect: Get dial tcp 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?

  • How to set up docker elasticsearch with node?
  • Installing osixia/docker-openldap using docker-compose
  • Running Lightttpd in Docker: ulimits not honored
  • How to create a service on the bridge network and the host network?
  • How to edit files inside a docker container?
  • Docker user authentication against LDAP over SSL
  • 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 | 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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.