dotnet-docker

repository·main·Indexed 26 days ago

https://github.com/dotnet/dotnet-docker

Official Docker images for .NET, including the SDK, ASP.NET Core runtime, and .NET runtime. This repository provides guidance on containerizing .NET applications, choosing image variants (including Distroless and Chiseled images), configuring container ports, and performing multi-platform builds. It includes sample Dockerfiles for various Linux distributions (Alpine, Azure Linux, Ubuntu) and Windows versions (Nano Server, Server Core), as well as documentation on image update and CVE policies.

Tokens
45K
Snippets
110
Records
247
Agent score
88%

What's inside dotnet-docker

  1. Overview of Ubuntu Chiseled .NET images

    main

    Ubuntu Chiseled images are distroless container images containing only the minimal set of packages required to run .NET applications. They are designed to reduce deployment size and attack surface by providing:

    • A minimal set of required packages
    • A non-root user by default
    • No package manager
    • No shell

    Note that there are no chiseled SDK images available; you should use standard full Ubuntu SDK images to build your applications and then run them on Chiseled images.

  2. Use ASP.NET Core Distroless images

    main

    Distroless container images contain only the minimal set of packages required for .NET applications. They are optimized for security and performance by removing everything else, including package managers and shells.

    Key Features:

    • Minimal package set for .NET.
    • Non-root user by default.
    • No package manager.
    • No shell.

    Available distroless variants include Azure Linux and Ubuntu (Chiseled).

  3. Explore .NET container build and development samples

    main

    This repository provides various samples for different .NET containerization scenarios. Key sample areas include:

    Building Images

    • Standard .NET apps: dotnetapp/README.md
    • ASP.NET Core apps: aspnetapp/README.md
    • Single file apps: releasesapp/README.md
    • Native AOT apps: releasesapi/README.md
    • Globalization/Time zone aware images: globalapp/README.md
    • Multi-platform builds: build-for-a-platform.md

    Development Guidance

    • Multi-project solutions: complexapp/README.md
    • SDK Container workflows: Build/test/run applications within an SDK container (build-in-sdk-container.md, run-tests-in-sdk-container.md, run-in-sdk-container.md)
    • Local HTTPS development: run-aspnetcore-https-development.md
    • Image Tag selection: ../documentation/supported-tags.md
  4. Understand .NET Distroless images

    main

    Distroless container images contain only the minimal set of packages required to run .NET applications. They are designed for improved security, smaller deployment sizes, and faster start-up times.

    Key characteristics:

    • Minimal package set for .NET.
    • Non-root user by default.
    • No package manager.
    • No shell.

    Available variants include Azure Linux and Ubuntu (Chiseled).

  5. Choose a .NET container image variant

    main

    Depending on your deployment needs, you can choose from several image variants:

    • SDK Images: For building .NET applications.
    • ASP.NET Core Runtime Images: For running web applications.
    • .NET Runtime Images: For running console/non-web applications.
    • Runtime Dependencies Images: For running apps that require specific OS dependencies.
    • Distroless Images: Optimized for security and size. They contain only the minimal set of packages required for .NET, include a non-root user by default, and contain no package manager or shell. Available for Azure Linux and Ubuntu (Chiseled).
  6. .NET Monitor Tool Overview

    main

    The .NET Monitor tool is a diagnostic tool used for capturing diagnostic artifacts (such as dumps and traces) in an operator-driven or automated manner. It is an ASP.NET application that hosts a web API for inspecting .NET processes and collecting diagnostic artifacts.

    Key features include:

    • Web API for process inspection and artifact collection.
    • Extensions for egressing artifacts to Azure Blob Storage and Amazon S3.
    • Can be run as a sidecar container to collect information from other containers running .NET Core 3.1 or .NET 5 and later.
  7. Use .NET Monitor Base as a base image for extensions

    main

    The .NET Monitor Base image provides the core installation of .NET Monitor, an ASP.NET application that hosts a web API for inspecting .NET processes and collecting diagnostic artifacts (like dumps and traces).

    Important: This image only contains base functionality. It is intended to be used as a base image upon which you install .NET Monitor extensions. If you require the full feature set (including egress capabilities) out of the box, use the dotnet/monitor image instead.

  8. Explore .NET with Docker Scenarios

    main
    The .NET with Docker Scenarios collection provides best practices, tips, and code samples for solving common issues when running .NET applications in Docker containers. Key scenarios include managing NuGet credentials, installing the .NET runtime in Dockerfiles, and handling specific package dependencies like System.Drawing.Common.
  9. Use .NET Distroless images

    main

    Distroless container images contain only the minimal set of packages required for .NET applications. They are optimized for security, deployment size, and start-up time.

    Key characteristics:

    • Minimal package set
    • Non-root user by default
    • No package manager
    • No shell

    Distroless images are available for Azure Linux and Ubuntu (Chiseled).