docker

Installation
SKILL.md

Docker

Core Principles

  1. Multi-stage builds always (in a Dockerfile) — Separate build and runtime stages. Build in the SDK image, run in the ASP.NET runtime image.
  2. Non-root by default — .NET container images support USER app by default since .NET 8. Never run as root in production.
  3. Layer caching matters — Copy .csproj files and restore before copying source code. This caches NuGet dependencies across builds.
  4. Pick the lightest tool that fits — A plain ASP.NET Core API or worker needs no Dockerfile: SDK container publish builds a chiseled, non-root OCI image from MSBuild properties. Write a Dockerfile only when you need OS packages, custom build steps, or a non-.NET stage. Details in references/sdk-container-publish.md.
  5. Health probes at the orchestrator level — Expose a /health/live endpoint and let Kubernetes/Compose probe it. Chiseled and default aspnet images have no shell or curl, so in-image HEALTHCHECK commands have nothing to run with.

Patterns

SDK Container Publish (No Dockerfile)

Installs
4.2K
GitHub Stars
853
First Seen
Apr 2, 2026