sdk-container-publishing
БесплатноБез исполняемых скриптовНе проверенPublish .NET services as container images with the built-in SDK tooling (dotnet publish /t:PublishContainer, Microsoft.NET.Build.Containers) - no Dockerfile…
от Aaronontheweb★ 1 284 звезды на GitHubОб этом скилле
.NET SDK Container Publishing
When to Use This Skill
Use this skill when:
- You want a container image for a .NET service and do not want to hand-write a Dockerfile
- You want to know how to tag, name, or expose ports on an SDK-built image without a Dockerfile
- You are wiring container publishing into CI / CD or a release pipeline
- An SDK-built image pushes to the wrong registry, gets the wrong tag, or picks the wrong base image
- You need a tarball of an image for scanning or air-gapped loading
Do not use it when:
- You need a
RUNstep or arbitrary layer customization in the image. The SDK tooling cannot emulateRUN; write a Dockerfile instead.
What This Is
Since .NET 7, dotnet publish builds a container image natively. The Microsoft.NET.Build.Containers tooling ships with the SDK, so no Dockerfile is required and no Docker install is needed to produce an image. Docker or Podman is only required to run the image locally. This is documented in the containerize with dotnet publish tutorial.
The quickest path is one command:
dotnet publish /t:PublishContainer -c Release
That compiles the app and emits an image in one step. The image name defaults to the project's AssemblyName. Override it with ContainerRepository (renamed from ContainerImageName in earlier versions - see the sdk-container-builds customization notes).
The Three Output Modes
The tooling writes the image in one of three ways. Pick based on where the image ends up.
| Mode | When to use |
|---|---|
| Local daemon (default) | Local dev. Pushes to the running Docker or Podman daemon with no extra config. |
| Tarball | You want a file to scan, transfer, or load later. Set ContainerArchiveOutputPath to a .tar.gz path, then docker load -i or podman load -i. Useful in security scanning workflows. |
| Registry push | Shipping. Set ContainerRegistry (for example ghcr.io or an internal registry) and the image is pushed directly. |
See the containerize a .NET app reference for the full property surface.
Key Facts
- No Docker required to build. The SDK creates the image itself; a runtime is only needed to run it. See the SDK publish tutorial.
- Image name defaults to
AssemblyName. SetContainerRepositoryto override. - Base image is inferred. Self-contained projects get
mcr.microsoft.com/dotnet/runtime-deps, ASP.NET Core getsdotnet/aspnet, other apps getdotnet/runtime, tagged for the TFM. Since SDK 8.0.200 the inference is size and security aware: musl RIDs pick Alpine variants,PublishAot=truepicks the chiseled AOT runtime-deps variant. See the base image inference notes. - Since .NET 8, the SDK tags images
latestwhen you do not set a tag. If your publish relies on the version tag you must setContainerImageTag(single tag) orContainerImageTags(list) explicitly. This is a real footgun in CI - see the tag drift entry in references/troubleshooting.md. - Windows images need an explicit base image. Microsoft no longer includes Windows variants in the manifest list. To target Windows, set
ContainerBaseImageto a specific nanoserver tag (for examplemcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-ltsc2022). See the Windows note. - Multi-architecture images come from
ContainerRuntimeIdentifiers(semicolon-delimited, a subset ofRuntimeIdentifiers). The output is an OCI image index. Supported from SDK 8.0.405, 9.0.102, and 9.0.2xx onward. - Insecure registries are passed via the
DOTNET_CONTAINER_INSECURE_REGISTRIESenv var (comma-separated) starting in SDK 9.0.100. Since .NET 8.0.400 the SDK reads standard Docker / Podman config to decide HTTP vs HTTPS.
The Minimal Property Set (the pattern we use)
Most of our services only override what they need and let the SDK infer the rest. A minimal csproj looks like this:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ContainerRepository>my-service</ContainerRepository>
<ContainerImageTags>$(VersionPrefix);latest</ContainerImageTags>
</PropertyGroup>
<ItemGroup>
<ContainerPort Include="8080" Type="tcp" />
</ItemGroup>
</Project>
Notes:
- No
ContainerRegistry, noContainerBaseImage, noContainerUser. The SDK defaults these correctly for most ASP.NET services. ContainerPortitems expose ports without a Dockerfile.- Tags follow semver: the package version plus a floating
latest-
Установить sdk-container-publishing в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл sdk-container-publishing?
Publish .NET services as container images with the built-in SDK tooling (dotnet publish /t:PublishContainer, Microsoft.NET.Build.Containers) - no Dockerfile required. Covers the MSBuild property surface, base-image inference, self-contained and AOT implications, and CI/CD publishing.
Как установить скилл sdk-container-publishing?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл sdk-container-publishing запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic