12.07.2019 Views

NET-Microservices-Architecture-for-Containerized-NET-Applications-(Microsoft-eBook)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

What OS to target with .<strong>NET</strong> containers<br />

Given the diversity of operating systems supported by Docker and the differences between .<strong>NET</strong><br />

Framework and .<strong>NET</strong> Core, you should target a specific OS and specific versions depending on the<br />

framework you are using.<br />

For Windows, you can use Windows Server Core or Windows Nano Server. These Windows versions<br />

provide different characteristics (IIS in Windows Server Core versus a self-hosted web server like<br />

Kestrel in Nano Server) that might be needed by .<strong>NET</strong> Framework or .<strong>NET</strong> Core, respectively.<br />

For Linux, multiple distros are available and supported in official .<strong>NET</strong> Docker images (like Debian).<br />

In Figure 3-1 you can see the possible OS version depending on the .<strong>NET</strong> framework used.<br />

Figure 3-1. Operating systems to target depending on versions of the .<strong>NET</strong> framework<br />

You can also create your own Docker image in cases where you want to use a different Linux distro or<br />

where you want an image with versions not provided by <strong>Microsoft</strong>. For example, you might create an<br />

image with ASP.<strong>NET</strong> Core running on the traditional .<strong>NET</strong> Framework and Windows Server Core, which<br />

is a not-so-common scenario <strong>for</strong> Docker.<br />

When you add the image name to your Dockerfile file, you can select the operating system and<br />

version depending on the tag you use, as in the following examples:<br />

microsoft/dotnet:2.1-runtime<br />

microsoft/dotnet:2.1-aspnetcoreruntime<br />

.<strong>NET</strong> Core 2.1 multi-architecture: Supports<br />

Linux and Windows Nano Server depending on<br />

the Docker host.<br />

ASP.<strong>NET</strong> Core 2.1 multi-architecture: Supports<br />

Linux and Windows Nano Server depending on<br />

the Docker host.<br />

The aspnetcore image has a few optimizations<br />

<strong>for</strong> ASP.<strong>NET</strong> Core.<br />

16 Choosing Between .<strong>NET</strong> Core and .<strong>NET</strong> Framework <strong>for</strong> Docker Containers

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!