June 28, 2016 by Anuraj
C# ASP.NET ASP.NET Core Docker Container
This post is about running your ASP.NET Core application on Docker for Windows. Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. Recently Docker introduced Docker for Windows and ASP.NET Team came up with Docker support for ASP.NET Core as well. To deploy ASP.NET Core application, first you need to download the docker for Windows. You can get it from here.
Docker for Windows installation is straight forward. Once installation is completed successfully, you will see docker running inside your system tray. And Docker will display a welcome windows like this.
You can verify your docker installation by running “docker run hello-world” command. You will see a response like this.
Once you see this create an application using aspnet yo generator. It will generate a docker file with dotnet core image. Here is the dockerfile.
Now you need to create an image with the dockerfile. You can do this using following command.
It will create a docker image with the name “dotnetthoughts/first”. You can find the existing images using “docker images” command. Once the docker image created, you can run the docker image using docker run command.
Once docker image running, you can see using “docker ps” command. And you can browse the application using the IP Address - 10.0.75.2 (default). Here is the ASP.NET Core application running on Docker.
Happy Programming :)
Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub