Search  
Always will be ready notify the world about expectations as easy as possible: job change page
Aug 20, 2018

Introduction to .NET and Docker

Source:
Views:
1012

This article provides an introduction and conceptual background to working with .NET on Docker.

Docker: Packaging your apps to deploy and run anywhere

 

Docker is an open platform that enables developers and administrators to build images, ship, and run distributed applications in a loosely isolated environment called a container. This approach enables efficient application lifecycle management between development, QA, and production environments.

The Docker platform uses the Docker Engine to quickly build and package apps as Docker images created using files written in the Dockerfile format that then is deployed and run in a layered container.

You can either create your own layered images as dockerfiles or use existing ones from a registry, like Docker Hub.

The relationship between Docker containers, images, and registries is an important concept when architecting and building containerized applications or microservices. This approach greatly shortens the time between development and deployment.

Further reading (and watching)

Getting .NET Docker images

The Official .NET Docker images are created and optimized by Microsoft. They are publicly available in the Microsoft repositories on Docker Hub. Each repository can contain multiple images, depending on .NET versions, and on OS versions. Most image repos provide extensive tagging to help you select both a specific framework version and an OS (Linux distro or Windows version).

Scenario based guidance

Microsoft’s intent for .NET repositories is to have granular and focused repos, which represent a specific scenario or workload.

The microsoft/aspnetcore images are optimized for ASP.NET Core apps on Docker, so containers can start faster.

The .NET Core images (microsoft/dotnet) are intended for console apps based on .NET Core. For example, batch processes, Azure WebJobs, and other console scenarios should use optimized .NET Core images.

The most obvious horizontal scenario for using Docker and .NET applications is for production deployment and hosting. It turns out that production is just one scenario and the other ones are equally useful. These scenarios are not specific to .NET, but should apply to most developer platforms.

  • Low friction install — You can try out .NET without a local install. Just download a Docker image with .NET in it.
  • Develop in a container — You can develop in a consistent environment, making development and production environments similar (avoiding issues like global state on developer machines). Visual Studio Tools for Docker even enable you to start a container directly from Visual Studio.
  • Test in a container — You can test in a container, reducing failures due to incorrectly configured environments or other changes left behind from the last test.
  • Build in a container — You can build code in a container, avoiding the need to correctly configure shared build machines for multiple environments but instead move to a “BYOC” (bring your own container) approach.
  • Deployment in all environments — You can deploy an image through all of your environments. This approach reduces failures due to configuration differences, typically changing the image behavior via external configuration (for example, injected environment variables).

General guidance for deciding between .NET Core and .NET Framework for Docker container development.

Exploring the rich Docker development ecosystem

Now that you have learned about the Docker platform and different Docker images, the next step is to explore the rich Docker ecosystem. The following links show you how the Microsoft tools complement container development.

Similar
Aug 14
Author: Yasith Wimukthi
In today’s fast-paced development environment, Docker has become a vital tool for developers, simplifying the process of creating, deploying, and running applications in containers. However, to truly harness the power of Docker, it’s crucial to follow best practices that ensure...
Jul 17
Author: Maarten Merken
I found myself in need of quickly converting my C# console application into a web application, primarily, I was asked to expose our console app’s logic through an API with very little time to manage it. This article will cover...
Jul 10, 2021
Author: Sam Walpole
I've recently gotten into using Docker in my development cycle and I'm really enjoying how much of a wonderful tool it is. One thing that always used to be a pain was setting up a development server to run SQL...
Aug 26, 2022
Author: Jaydeep Patil
We are going to discuss the RabbitMQ Message Queue and its implementation using .NET Core 6 API as Message Producer and Console Application as a Message Consumer. Agenda Introduction of RabbitMQ Benefits of using RabbitMQ Implementation of RabbitMQ in .NET...
Send message
Type
Email
Your name
*Message