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\\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.

Comments (2)

  1. Salam says:

    Hi Steve, just finished setting up everything ad can see “Add docker support” item in the menu, However, I visited my C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\ItemTemplatesCache\CSharp directory, no Docker directory exists.
    I only found a docker directory at
    E:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft
    Thanks for your help

    1. Steve Lasker says:

      Hi Salam,
      As we’ve been iterating quickly on the Visual Studio Docker Tools, this post is fairly outdated and not representative of the current tools shipping with Visual Studio 2015, or the most recent tools with Visual Studio 2017 RC.

Skip to main content