Running VS 2015 Tools for Docker in Azure VM

Recently I tried to deploy the ASP.NET 5 web app to remote docker host by following the post in this article. The reason I want to deploy to remote host because my development machine is an Azure VM and the docker machine from the Docker Toolbox  won’t be able to create a docker host (a Virtualbox VM) locally.

There are some missing information in the article, such as to be able to deploy to remote docker host (VM), the remote host needs to be registered to local docker machine. In this post I will explain how to register the remote docker host to docker machine running locally.

This is the steps based on this article with some additional steps

  1.  Prerequisite: The Create an Azure Docker Host VM instead of following the article I just using Azure portal to create a basic A0 VM based on Ubuntu 16.04 image and install docker by running wget -qO- | sh as explained in this article. In my case I have machine name: and login name: mylogin
    And in addition, install Docker Toolbox for Windows. We need docker-machine and Git bash from this installation as VS Tools for Docker using it.
  2. Nothing changes in this step: Create ASP.NET 5 web app
  3. Add Docker support: nothing changes
  4. Point to remote docker host. Note. the {name-of-your-vm} is the docker host vm name you created in the step 1 above for example:
  5. In this step we need to setup several endpoints (ports) in our remote docker host (ubuntu vm): 80, 2376 (for docker machine) and 22 (ssh). And then do the additional config below to register Ubuntu docker host to local docker-machine.

Below is the additional config to make the local docker-machine to talk to our remote host:

a).Allow port 2376 in the remote host (Ubuntu). SSH (using PuTTY) to remote Ubuntu host and run this command

sudo ufw allow 2376

b).Setting non-password sudo user. Still in the ssh session above run these commands.$sudo adduser mylogin sudo$sudo visudo

c). Setting ssh rsa key. Back to your development Windows VM, open Git bash and run below command. as in this article step 1.The command above will generate ssh keys and store it in /user/username/.ssh/.


d). Then copy this public key to the remote host. Unfortunately step2 in the article above doesn’t work as Git bash in windows doesn’t have ssh-copy-id command. So we need to do the work around as in this article. Run below command in Git bash. Replace username,mylogin and mydockertest accordingly

  cat /users/username/.ssh/ | ssh -p 22 "cat - >> ~/.ssh/authorized_keys"

e). Test is ssh is working by running from Git bash.


f). After your development VM can ssh to remote host. We need to register the remote host to local docker machine by running this command below. Reference of this command is in here The location of the docker-machine.exe is in the Program Files where Docker Toolbox installed. Replace the mylogin and mydocktertest accordingly. You can remove the –debug flag from the command.

docker-machine.exe --debug create --driver generic --generic-ip-address -generic-ssh-user mylogin

g). Check if the the remote docker host is registered to local dockar machine by running this command

docker-machine.exe ls


Now we can build the Visual Studio Project as in the step 6 in this article. Please make sure you change the DockerMachineName in the Docker.props file as in the step 4 above. After the container is deployed you can ssh to the Ubuntu VM and run this command

sudo docker ps