dotnet-containers

Containerize .NET applications with multi-stage Dockerfiles and dotnet publish.

71|10|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-containers-wshaddix
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-containers
Source: https://github.com/wshaddix/dotnet-skills/tree/main/skills/dotnet-containers
Command: npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-containers-wshaddix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides best practices and patterns for containerizing .NET applications, ensuring efficient, secure, and minimal Docker images.

Core Features & Use Cases

  • Multi-Stage Dockerfiles: Create lean production images by separating build and runtime environments.
  • dotnet publish Container Feature: Leverage .NET 8+ built-in capabilities for direct container image creation.
  • Rootless Containers: Enhance security by running containers as non-privileged users.
  • Base Image Selection: Guidance on choosing the optimal .NET base image (e.g., chiseled, alpine).
  • Health Checks: Implement application-level health checks for container orchestration.
  • Use Case: You need to deploy a new ASP.NET Core API to a containerized environment. This Skill will guide you in creating an optimized Dockerfile and using dotnet publish to build a secure, minimal image.

Quick Start

Use the dotnet-containers skill to generate a multi-stage Dockerfile for a standard ASP.NET Core application.

Frequently Asked Questions about dotnet-containers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a minimal Docker image for an ASP.NET Core application?

To create a minimal Docker image for an ASP.NET Core application, use multi-stage Dockerfiles to separate build and runtime environments, and select optimal base images like Alpine or chiseled. This approach ensures a lean, efficient production container.

Can I build a .NET container without a Dockerfile?

Yes, you can build a .NET container without a Dockerfile by using the `dotnet publish /t:PublishContainer` feature. This .NET 8+ built-in capability directly creates OCI-compliant container images, streamlining the deployment workflow.

What's the best way to run a .NET container as a non-root user?

The best way to run a .NET container as a non-root user is to configure rootless containers. This technique enhances security by executing the application process as a non-privileged user within the container environment.

How do I implement health checks for containerized .NET apps?

To implement health checks for containerized .NET apps, configure application-level health endpoints. This allows container orchestration platforms to monitor application availability and automatically manage restarts or traffic routing.

Does the dotnet publish container feature support layer caching?

Yes, the dotnet publish container feature supports layer caching strategies. By leveraging `.dockerignore` and optimizing build contexts, you can efficiently cache dependencies and reduce build times during container creation.

How does base image selection impact .NET container globalization support?

Base image selection directly impacts .NET container globalization support. Choosing minimal base images like Alpine requires specific configuration to ensure proper localization and globalization features function correctly in production.