OCI image publishing reference
November 12, 2025 ยท View on GitHub
This document lists the properties needing to publish OCI images. It is part of a container workshop, which details fundamental workflows for using .NET in containers.
Enable publishing
OCI image publishing is not enabled by default with dotnet publish. Most users do not want to generate a container image every time they publish their project, but an app they can run directly.
Container publishing can be enabled with one of the following gestures:
PublishContainer-- Include this target with-t:PublishContaineron the commandline.PublishProfile-- Set this property with-p PublishProfile=DefaultContaineron the commandline or in a project file. This property is only available to ASP.NET Core apps or Worker apps.
Configure publishing
These properties can be used to configure OCI image publishing.
ContainerFamily-- Use a specific family of base images, such as with-p ContainerFamily=noble-chiseledor-p ContainerFamily=alpine.ContainerRepository-- Use a different image name than the default, such as with-p ContainerRepository=mycustomimagename.ContainerRegistry-- The registry address to push to, such asdocker.ioormyregistry.azurecr.io.ContainerArchiveOutputPath-- Publishes the image as a tarball to the specified directory.
These container properties can be specified in a project file in a ProperyGroup section, as follows.
<PropertyGroup>
<ContainerFamily>noble-chiseled</ContainerFamily>
<ContainerRepository>mycustomerimagename</ContainerRepository>
<ContainerRegistry>docker.io</ContainerRegistry>
</PropertyGroup>