docker
Skill853 starsChanged yesterdayMITView on GitHub
Containerizing .NET 10 apps: multi-stage Dockerfile or Dockerfile-less SDK publish (`dotnet publish /t:PublishContainer`), non-root and chiseled images, layer caching, Compose, multi-arch. Use for "Docker", "Dockerfile", "docker-compose", "multi-stage", "PublishContainer", "chiseled", "container image". Do NOT use for CI pipeline YAML (use ci-cd) or Aspire AppHost orchestration (use aspire).
61 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- anmolnagpal/devops-skillstheir own version, first seen Nov 29, 2026
- Ghost7802/awesome-api-skillstheir own version, first seen Nov 29, 2026
- amutaal122/ai-engineer-mastertheir own version, first seen Nov 29, 2026
- marcioaltoe/skillstheir own version, first seen Nov 29, 2026
- jawwad-ali/claude-code-skillstheir own version, first seen Nov 20, 2026
- fworks-tech/agenthoodtheir own version, first seen Nov 19, 2026
Used with
Projects with it also use scalar, ml-training-recipe and 8 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Sorcha-PlatformSkillscalar
Generates and configures Scalar OpenAPI UI for API documentation. Use when: Adding API documentation to services, configuring OpenAPI endpoints, customizing documentation themes
Also in 3 projects that use this
getcompanion-aiSkillml-training-recipe
Find implementable ML training recipes from papers, datasets, docs, and code. Use when the user wants to fine-tune, train, reproduce, or choose a practical ML method, dataset, hyperparameter setup, or benchmark recipe.
Also in 3 projects that use this
getcompanion-aiSkillreplication
Plan a replication of a paper, claim, or benchmark, and execute only after an explicit environment choice. Use when the user asks to replicate results, reproduce an experiment, verify a claim empirically, or build a replication package.
Also in 3 projects that use this
brainbytes-devSkillalpha-research
Also in 3 projects that use this
JaimeParkerSkillpaper-code-audit
Perform three-way cross-validation of a research paper by comparing the original paper text (via Zotero), official code implementation (via Git), and personal Obsidian notes. Use this skill whenever the user wants to "audit a paper", "verify paper claims against code", "cross-check notes with implementation", "triangulate paper + code + notes", "find discrepancies between paper and code", or mentions wanting a deep, structured comparison of a paper's claims against its implementation and their own notes. Also trigger when the user asks to "analyze this paper thoroughly" with code available, or when they want to systematically reconcile what the paper says, what the code does, and what their notes claim.
Also in 3 projects that use this
Sorcha-PlatformSkillredis
Implements Redis caching, session management, and distributed coordination for the Sorcha platform. Use when: Adding caching layers, token revocation, rate limiting, SignalR backplane, or distributed state.
Also in 5 projects that use this
- +1 more from getcompanion-ai
Other versions61 projects use a version of this.
Word for word · 1
- codewithmukesh/dotnet-claude-kit★ 853100% same
Edited · 1
- Resgrid/Core★ 23972% same
Wrote their own version · 59
- getcompanion-ai/feynman★ 10ksame name
- advaitpaliwal/feynman★ 10ksame name
- companion-inc/feynman★ 10ksame name
- TheDecipherist/claude-code-mastery-project-starter-kit★ 337same name
- Mindrally/skills★ 275same name
- kid-sid/claude-spellbook★ 190same name
- OpenHands/extensions★ 167same name
- avibebuilder/claude-prime★ 119same name
- nahid-sparktales/agent-dispatcher★ 59same name
- kumaran-is/claude-code-onboarding★ 35same name
49 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository38 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .codex/AGENTS.mdAGENTS.md
- .opencode/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/dotnet-rules.mdCursor rule
- architecture-advisorSkill
- aspireSkill
- authenticationSkill
- build-fixSkill
- cachingSkill
- ci-cdSkill
- code-reviewSkill
- configurationSkill
- console-cliSkill
- dependency-injectionSkill
- desktop-mvvmSkill
- de-sloppifySkill
- doctorSkill
- dotnet-initSkill
- ef-coreSkill
- error-handlingSkill
- instinct-systemSkill
- loggingSkill
- messagingSkill
- migrateSkill
- minimal-apiSkill
- modern-csharpSkill
- modular-slicesSkill
- native-aotSkill
- openapiSkill
- opentelemetrySkill
- resilienceSkill
- scaffoldSkill
- specSkill
- tddSkill
- testingSkill
- verifySkill
- wrap-upSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 52 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 77
Prefer orchestrator-level probes (Kubernetes livenessProbe, Compose healthcheck) over a Dockerfile HEALTHCHECK — the standard aspnet and …
- Very specific: line 96
If you must have an in-image HEALTHCHECK, base the runtime stage on a non-chiseled image that includes wget — never re-run the app binary …
- Very specific: line 222
Keep the Dockerfile when you need apt-get, native libraries, or extra build stages.
“Common” is measured: kept by at least 6 in 10 of the 52 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Docker
Core Principles
- Multi-stage builds always (in a Dockerfile) — Separate build and runtime stages. Build in the SDK image, run in the ASP.NET runtime image.
- Non-root by default — .NET container images support
USER appby default since .NET 8. Never run as root in production. - Layer caching matters — Copy
.csprojfiles and restore before copying source code. This caches NuGet dependencies across builds. - 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. - Health probes at the orchestrator level — Expose a
/health/liveendpoint and let Kubernetes/Compose probe it. Chiseled and default aspnet images have no shell or curl, so in-imageHEALTHCHECKcommands have nothing to run with.
Patterns
SDK Container Publish (No Dockerfile)
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ContainerRepository>mycompany/myapp-api</ContainerRepository>
<ContainerFamily>noble-chiseled</ContainerFamily>
</PropertyGroup>dotnet publish /t:PublishContainer --os linux --arch x64Why: settings live in the .csproj, so nothing drifts, and the result is an OCI image with the non-root app user and no shell. Always pass --os linux on Windows or you may get a Windows image. Chiseled variants, registries, multi-arch, tags, tarball output, and CI are in references/sdk-container-publish.md.
Multi-Stage Dockerfile for Web API
# Stage 1: Build
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
# Copy project files and restore (cached layer)
COPY ["src/MyApp.Api/MyApp.Api.csproj", "src/MyApp.Api/"]
COPY ["src/MyApp.Domain/MyApp.Domain.csproj", "src/MyApp.Domain/"]
COPY ["Directory.Build.props", "."]
COPY ["Directory.Packages.props", "."]
RUN dotnet restore "src/MyApp.Api/MyApp.Api.csproj"
# Copy everything and build
COPY . .
RUN dotnet publish "src/MyApp.Api/MyApp.Api.csproj" \
-c Release \
-o /app/publish \
--no-restore
# Stage 2: Runtime
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS runtime
WORKDIR /app
# Non-root user (default in current .NET images)
USER app
COPY --from=build /app/publish .
EXPOSE 8080
ENTRYPOINT ["dotnet", "MyApp.Api.dll"]Container Health Probes
Prefer orchestrator-level probes (Kubernetes livenessProbe, Compose
healthcheck) over a Dockerfile HEALTHCHECK — the standard aspnet and
chiseled images ship no shell, no curl, and no wget, so there is nothing inside
the container to run the probe with. Point the orchestrator at /health/live:
# docker-compose — probe from outside the app process
services:
api:
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://localhost:8080/health/live || exit 1"]
interval: 30s
timeout: 3s
retries: 3
# Note: CMD-SHELL requires a shell + wget in the image. Use a non-chiseled
# variant for this, or better: let Kubernetes httpGet probes do it —
# they run from the kubelet, needing nothing inside the image.If you must have an in-image HEALTHCHECK, base the runtime stage on a
non-chiseled image that includes wget — never re-run the app binary as the
probe command; that starts a second instance instead of checking the first.
.dockerignore
**/.git
**/.vs
**/bin
**/obj
**/node_modules
**/Dockerfile*
**/docker-compose*
**/testsDocker Compose for Local Development
Key .NET-specific concerns — pass connection strings via environment, use depends_on with health checks:
services:
api:
build:
context: .
dockerfile: src/MyApp.Api/Dockerfile
ports:
- "5000:8080"
environment:
- ASPNETCORE_ENVIRONMENT=Development
- ConnectionStrings__Default=Host=postgres;Database=myapp;Username=postgres;Password=postgres
- ConnectionStrings__Redis=redis:6379
depends_on:
postgres:
condition: service_healthy
# Add postgres/redis services with healthcheck — standard boilerplateOptimized Build with .slnx
For solutions with multiple projects, restore only the necessary projects.
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
WORKDIR /src
# Copy solution and all project files
COPY *.slnx .
COPY Directory.Build.props .
COPY Directory.Packages.props .
COPY src/**/*.csproj ./src/
# Restore project structure
RUN for file in src/**/*.csproj; do \
mkdir -p $(dirname $file) && mv $file $(dirname $file)/; \
done
RUN dotnet restore
COPY . .
RUN dotnet publish src/MyApp.Api -c Release -o /app/publish --no-restoreHealth Check Endpoint
// In Program.cs — lightweight health endpoint for Docker
app.MapGet("/health/live", () => Results.Ok("healthy"))
.ExcludeFromDescription();Anti-patterns
Don't Use SDK Image for Runtime
# BAD — SDK image is 900MB+, includes compilers
FROM mcr.microsoft.com/dotnet/sdk:10.0
COPY . .
RUN dotnet run
# GOOD — separate build and runtime, runtime image is ~200MB
FROM mcr.microsoft.com/dotnet/aspnet:10.0Don't Copy Everything Before Restore
# BAD — any source change invalidates the NuGet cache
COPY . .
RUN dotnet restore
# GOOD — copy only project files first, then restore
COPY ["src/MyApp.Api/MyApp.Api.csproj", "src/MyApp.Api/"]
RUN dotnet restore "src/MyApp.Api/MyApp.Api.csproj"
COPY . .Don't Run as Root
# BAD — running as root (security risk)
FROM mcr.microsoft.com/dotnet/aspnet:10.0
COPY --from=build /app .
ENTRYPOINT ["dotnet", "MyApp.Api.dll"]
# GOOD — use the built-in non-root user
FROM mcr.microsoft.com/dotnet/aspnet:10.0
USER app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "MyApp.Api.dll"]Don't Fight the SDK Publisher With a Dockerfile
# BAD: 15 lines of Dockerfile that reproduce what MSBuild already does
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
# restore, publish, copy, USER app, EXPOSE, ENTRYPOINT ...<!-- GOOD for a standard API or worker: properties in the csproj, no Dockerfile -->
<ContainerFamily>noble-chiseled</ContainerFamily>Keep the Dockerfile when you need apt-get, native libraries, or extra build stages. SDK publish has no RUN equivalent; the workaround is a custom base image referenced by ContainerBaseImage.
Decision Guide
| Scenario | Recommendation |
| Standard ASP.NET Core API | SDK container publish with noble-chiseled, or a multi-stage Dockerfile if the team prefers explicit control |
| Worker service / console app | SDK container publish, or Dockerfile with the dotnet/runtime image |
| Needs native OS packages or custom build steps | Dockerfile (or custom base image + SDK publish) |
| Azure Functions | Dockerfile (not supported by SDK publish) |
| CI without a Docker daemon | SDK publish with ContainerArchiveOutputPath tarball |
| Multi-arch (x64 + arm64) | ContainerRuntimeIdentifiers with SDK publish |
| Local development stack | Docker Compose with service dependencies |
| Dockerfile CI builds | Multi-stage build (self-contained) |
| Image size optimization | Chiseled base, or Alpine variant + trimming; Native AOT for the smallest image |
| Health monitoring | /health endpoint + orchestrator probe (K8s httpGet / Compose healthcheck) |
| Secrets | Environment variables or mounted secrets, never in image |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

