Defaulting to Docker for Windows with Docker Tools for Visual Studio

When using Docker Tools for Visual Studio, we default the Docker host to use Docker Toolbox. Or, more specifically, we set the default docker machine to be named default, which people typically create a VirtualBox host named default. This is documented here.

Docker for Windows doesn't use Docker-Machine, rather assumes no HOST entries are set. To make Docker Tools for Visual Studio work with Docker for Windows, we'll need to change the host. In the Debugging apps in a local Docker container walk through, we show how to change the host once added to your project. However, if you're always using Docker for Windows, why not change the default template?

Our intention is to move to Docker for Windows as the default host once it's released publicly, and make this docker.props an easier file/designer to edit. In the meantime, if you're using Docker for Windows, and want to set the default to use it as your host, you can edit the Visual Studio template with the following steps.

    • Launch Notepad as Administrator
    • Open C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplatesCache\CSharp\Docker\1033\Docker.ASPNetTemplate.zip\Properties\Docker.props
    • Remove  $DockerMachineName$  from the following line
      <DockerMachineName Condition=" '$(DockerMachineName)'=='' ">$DockerMachineName$</DockerMachineName>
      it should now look like:
      <DockerMachineName Condition=" '$(DockerMachineName)'=='' "></DockerMachineName>
    • Save the file

You're all set. The next time you Add Docker Support to your project, it will now default to the Docker for Windows beta.