How to Dockerize an ASP.Net Core application

Learn how to build, deploy, and run your ASP.Net Core application in a lightweight, portable Docker container

Become An Insider

Sign up now and get FREE access to hundreds of Insider articles, guides, reviews, interviews, blogs, and other premium content. Learn more.

Docker containers are used to provide a lightweight and more portable alternative to virtual machines. Unlike virtual machines, which must bundle a complete operating system, containers typically encapsulate only an application, its runtime, and its dependent libraries. Docker is an open-source toolkit that allows you to build, deploy, and manage containers with ease.

A container may be defined as a unit of software that comprises the code and the necessary dependencies that enable an application to be executed inside its own environment. Thus containers are isolated from one another, but they share the same host operating system. That host operating system—be it Windows or Linux—must have the Docker runtime installed. 

This article presents a discussion on how we can deploy an ASP.Net Core application in a Docker container. Note that we will be using Docker on Windows here. Note too that unlike with virtual machines, you can’t run Windows and Linux containers on the same host. All containers must be native to the host operating system. 

Install Docker for Windows

To build and deploy an ASP.Net Core application in Docker, you need Visual Studio 2017 and Docker for Windows installed in your system. While Visual Studio 2017 will be used for building the application, Docker for Windows will be used to package and deploy the application in a Docker container. If you don’t have Visual Studio 2017 installed, you can download Visual Studio 2017 here. You can download Docker for Windows here

To continue reading this article register now