of ASP.NET Application

Dockerfile and Nuget

Dockerization of ASP.NET Application requires a Dockerfile for configuration and running it as a docker container.

FROM microsoft/dotnet:latest

RUN apt-get update && apt-get install sqlite3 libsqlite3-dev

COPY . /app


RUN ["dotnet", "restore"]

RUN ["dotnet", "build"]

RUN npm install && npm run postscript

RUN bower install 

RUN ["dotnet", "ef", "database", "update"]

EXPOSE 5000/tcp

ENTRYPOINT ["dotnet", "run", "--server.urls", ""]

A nuget feed configuration file helps in retrieving from the correct source. The usage of this file depends on the current configuration of the project and can change to suite project's requirement.

 <?xml version="1.0" encoding="utf-8"?>
     <add key="" value=""  protocolVersion="3" />
     <add key="enabled" value="True" />
     <add key="automatic" value="True" />
    <add key="skip" value="False" />


"Data": {
    "DefaultConnection": {
        "ConnectionString": "Host=localhost;Username=postgres;Password=******;Database=postgres;Port=5432;Pooling=true;"


It is nessecary to have .NET or a mono-aspnet package.

It is important to understand the importance of dockerization. Install dotnet on ubuntu or the OS you are working on.

Installing DOTNET

$ sudo sh -c 'echo "deb [arch=amd64] trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
$ sudo apt-key adv --keyserver --recv-keys 417A0893
$ sudo apt-get update

Ubuntu 16.04

$ sudo sh -c 'echo "deb [arch=amd64] xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
$ sudo apt-key adv --keyserver --recv-keys 417A0893
$ sudo apt-get update

Install .NET Core SDK

$ sudo apt-get install dotnet-dev-1.0.0-preview2-003121


For installation of Docker follow,


Kestrel server port : 5000 
Docker Deamon will listen to port :

 EXPOSE 5000/tcp

For building docker :

 $ sudo docker build -t myapp .

For running the docker container :

 $ sudo docker run -t -d -p 8195:5000 myapp

For visiting site :

$ ifconfig 

eth0 : ***.***.**  

Site will be available on (given this configuration.) :


Docker Processes. It will list running processes.

  $ sudo docker ps

To delete the process or the container.

 $ sudo docker rm -rf <process_id>