Docker Integration for Visual Studio Developers

Containerization using Docker

As implementation of solutions based on micro services and containerization are growing like never before, it is important for us to weigh the advantages.  As we know, Docker in this area has gone way ahead of others. Even though it evolved as a container solution based on Linux, of late native support for Docker has been released in Windows Server 2016 and Windows 10 OS.

Docker for Visual Studio Developers


Support for Docker is available in Visual Studio 2017. To build, run and debug your applications from VS in Docker container, you should install Docker for Windows ( installed on your PC in addition to Visual Studio 2017.

Once installed, you can specify the option as below to enable Docker support while creating your project. Alternately you can right click on the particular project in solution explorer and use Add->Docker Support.


Visual studio integration adds the following files to your project

  • Dockerfile – build instructions for the image

Compose Files (to define and run multi-container applications with Docker)

  • Docker-compose.yml

The docker-compose.yml file contains the name of the image that is created when project is run

version: '2'
 image: microsoft/aspnetcore-build:1.1.0-msbuild
 - .:/src
 working_dir: /src
 command: /bin/bash -c "dotnet restore && dotnet publish -c Release -o ./bin/Release/PublishOutput"

Sample Dockerfile

FROM microsoft/aspnetcore:1.1
ARG source
COPY ${source:-obj/Docker/publish} .
ENTRYPOINT ["dotnet", "MyDockerApplication.dll"]