Creating an ASP.NET Core Docker application and deploying to Azure

This blog is a simple step through, which creates an ASP.NET Core Docker image using Visual Studio 2017, deploys it to Docker Hub and then deploys the image to Azure.

Thanks to Malte Lantin for his fantastic posts on MSDN. See the links at the end of this post.


2017.02.03: Updated to VS2017 RC3 msbuild3

Step 1: Create a Docker project in Visual Studio 2017 using ASP.NET Core

In the example, an ASP.NET Core Visual Studio 2017 project using msbuild is used as the demo application. Then the Docker support is added to the project using Visual Studio 2017.

Right click the project, Add/Docker Project Support

Update the docker files to ASPNET.Core and the correct docker version as required. More information can be found here:

Now the application will be built in a layer on top of the microsoft/aspnetcore image.


FROM microsoft/aspnetcore:1.0.3
ARG source
COPY ${source:-bin/Release/PublishOutput} .
ENTRYPOINT ["dotnet", "AngularClient.dll"]


version: '2'

    image: angularclient
      context: .
      dockerfile: Dockerfile

Once the project is built and ready, it can be deployed to docker hub. Do a release build of the projects.

Step 2: Build a docker image and deploy to docker hub

Before you can deploy the docker image to docker hub, you need to have, or create a docker hub account.

Then open up the console and create a docker tag for your application. Replace damienbod with your docker hub user name. The docker image angularclient, created from Visual Studio 2017, will be tagged to damienbod/aspnetcorethingsclient.

docker tag angularclient damienbod/aspnetcorethingsclient

Now login to docker hub in the command line:

docker login

Once logged in, the image can be pushed to docker hub. Again replace damienbod with your docker hub name.

docker push damienbod/aspnetcorethingsclient

Once deployed, you can view this on docker hub.


For more information on docker images and containers:

Step 3: Deploy to Azure

Login to and click the new button and search for Web App On Linux. We want to deploy a docker container to this, using our docker image.

Select the + New and search for Web App On Linux.

Then select. Do not click the create until the docker container has been configured.


Now configure the docker container. Add the new created image on docker hub to the text field.


Click create and the aplication will be deployed on Azure. Now the application can be used.


And the application runs as requires.



The Visual Studio 2017 docker tooling is still rough and has problems when using newer versions of docker, or the msbuild 1.1 versions etc, but it is still in RC and will improve before the release. Next steps are now to use CI to automatically complete all these steps, add security, and use docker compose for multiple container deployments.


Orchestrating multi service core application using docker-compose

Debugging Asp.Net core apps running in Docker Containers using VS 2017


  1. […] Creating an ASP.NET Core Docker application and deploying to Azure […]

  2. Great stuff,thank you for sharing the links and snapshots its really useful

  3. […] vind ik onder andere de Docker integratie, Red Gate tooling en betere PowerShell Tools support de meest belangrijke […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: