containerize-aspnetcore

Generates a multi-stage Dockerfile and .dockerignore for ASP.NET Core projects.

1|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/AlahmadiQ8/sre-agent-demo --skill containerize-aspnetcore-alahmadiq8
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: containerize-aspnetcore
Source: https://github.com/AlahmadiQ8/sre-agent-demo/tree/main/.claude/skills/containerize-aspnetcore
Command: npx skills add https://github.com/AlahmadiQ8/sre-agent-demo --skill containerize-aspnetcore-alahmadiq8

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Manually writing Dockerfiles for ASP.NET Core applications requires choosing correct base images, configuring multi-stage builds, handling dependencies, and applying security practices, which is error-prone and time-consuming. ## Core Features & Use Cases - Dockerfile Generation: Creates a multi-stage Dockerfile using official mcr.microsoft.com .NET SDK and runtime images matched to the project's TargetFramework. - Linux Distribution Support: Configures Debian, Alpine, Ubuntu, Chiseled, or Azure Linux (Mariner) base images with appropriate package managers. - Security & Health Checks: Runs the container as a non-root user ($APP_UID) and adds HEALTHCHECK instructions when an endpoint is specified. - Use Case: Point the skill at a .csproj file and receive a verified Dockerfile and .dockerignore, with the Docker build executed and confirmed to succeed. ## Quick Start Containerize the ASP.NET Core project at src/MyApp/MyApp.csproj using .NET 8 on Alpine Linux and verify the Docker build succeeds.

Frequently Asked Questions about containerize-aspnetcore

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

FAQPage Schema
How do I containerize an ASP.NET Core application with Docker?

Provide the path to your .csproj file and the skill generates a multi-stage Dockerfile using the .NET SDK image for building and the ASP.NET Core runtime image for the final stage. It also creates a .dockerignore file and runs docker build to verify success.

What base images should I use for a .NET Docker container?

Use mcr.microsoft.com/dotnet/sdk for the build stage and mcr.microsoft.com/dotnet/aspnet for the runtime stage. Tags are available for Debian (bookworm-slim), Ubuntu (noble), Alpine, Chiseled, and Azure Linux variants matched to your .NET version.

Does the Dockerfile support Alpine Linux or chiseled images?

Yes, the skill supports Alpine, Ubuntu Chiseled, and Azure Linux (Mariner) in addition to Debian. Package installation commands are adjusted per distribution, using apk for Alpine and tdnf for Azure Linux.

How do I run a Docker container as a non-root user in .NET?

Set USER $APP_UID in the final stage of the Dockerfile. The official .NET 8+ container images define this variable, so no new user needs to be created manually.

Why does my Docker build fail for an ASP.NET Core project?

Common causes include mismatched .NET SDK versions, missing NuGet.config for private feeds, or incorrect csproj copy paths. The skill detects the TargetFramework from the csproj and iterates on build errors until the build succeeds.