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:

  • asp.net mvc in container in an azure windows app service
  • Does Azure Service Fabric do the same thing as Docker?
  • How can I link docker containers in mesos cluster (dc/os) running on Azure?
  • How to access jupyter notebook from docker on server?
  • Docker on Windows Server 2016 TP4 Downloading git in container through powershell
  • Resized Azure VM based on the Linux Docker+Rethinkdb image and the data was lost, is this to be expected?
  • An error occurred trying to connect: Get https://myvmname.cloudapp.net:4243/v1.20/info: dial tcp 40.127.169.184: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:

    • https://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-docker-with-xplat-cli/
    • http://blog.siliconvalve.com/2015/01/07/get-started-with-docker-on-azure/

    However, there’s plenty of other articles saying the same thing.

    Does anyone know what I’m doing wrong?

  • Bluemix Container shutdown issue
  • docker: gitlab + traefik & port 22
  • Copy directory before update and import after compile.
  • How to mount a docker volume while using a windows host?
  • Why doesn't the container start?
  • How use can I use “babel-watch debug” for debugging with chrome?
  • 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.

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