Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels. (Wikipedia)
Docker itself now currently it is a trend for mostly application deployment. With Docker, we don’t have painfull when to deploy to other environment. Because we just publish our docker with all the configuration that we already setup it before and re-use again when want to deploy it to other machine. With minor of configuration as well (Easy to distribute)
Here as below the my sample application using asp.net core and publish it to docker :
- Create new project. Choose the ASP.Net Core web app like on screenshot below
2. Test run the web apps
Yeayy! now you already done to create one asp.net core application 🙂
3. Add Docker support.
To download docker for windows you can go to this link https://www.docker.com/products/docker-desktop. Download and install it.
Dockerfile is a text based file (but having no extension). It contains instructions telling how to assemble a docker image. In Visual Studio you can create Dockerfile effortlessly by right clicking the app name in the solution explorer then select Add ➤Docker Support.
For this project, i choose target os is Linux
5. ASP.NET Core Dockerfile structure
6. Build the Project and Docker will listed on the docker UI.
7. Run the application and choose Docker as environment
Once it is already deployed, you can check all the pages that already deploy it with bash.
8. Push to Hub
Let say we already did all the progamming and setup on this docker. We can push it to the hub, then we can deploy it to other machine which already had also the docker.