Skip to content

Commit 3081d7f

Browse files
baronfelgewarren
andauthored
update container labels docs with complete table of labels provided by the tooling (#44638)
* update container labels docs with complete table of labels provided in-box * Update docs/core/containers/publish-configuration.md Co-authored-by: Genevieve Warren <[email protected]> * Update docs/core/containers/publish-configuration.md Co-authored-by: Genevieve Warren <[email protected]> * Update description of default container labels --------- Co-authored-by: Genevieve Warren <[email protected]>
1 parent 5665ee7 commit 3081d7f

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

docs/core/containers/publish-configuration.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ For example, consider the fully qualified `mcr.microsoft.com/dotnet/runtime:8.0-
4949
Some properties described in the following sections correspond to managing parts of the generated image name. Consider the following table that maps the relationship between the image name and the build properties:
5050

5151
| Image name part | MSBuild property | Example values |
52-
|-------------------|-----------------------|-------------------------|
52+
| ----------------- | --------------------- | ----------------------- |
5353
| `REGISTRY[:PORT]` | `ContainerRegistry` | `mcr.microsoft.com:443` |
5454
| `PORT` | `ContainerPort` | `:443` |
5555
| `REPOSITORY` | `ContainerRepository` | `dotnet/runtime` |
@@ -411,11 +411,25 @@ dotnet publish -p ContainerUser=root
411411

412412
### Default container labels
413413

414-
Labels are often used to provide consistent metadata on container images. This package provides some default labels to encourage better maintainability of the generated images.
415-
416-
- `org.opencontainers.image.created` is set to the ISO 8601 format of the current value of <xref:System.DateTime.UtcNow?displayProperty=nameWithType>.
417-
418-
For more information, see [Implement conventional labels on top of existing label infrastructure](https://github.com/dotnet/sdk-container-builds/issues/96).
414+
Labels are often used to provide consistent metadata on container images. The built-in container tools provide some default labels to increase the quality of the generated images. All default label generation can be disabled by setting `ContainerGenerateLabels` to `false`. In addition, each default label has an individual enablement flag that can be set to `false` to disable that specific label.
415+
416+
Where possible, existing MSBuild properties provide the values for these labels. Other properties allow for explicit control of their values.
417+
418+
| Annotation | Default Value | Dedicated Property Name | Fallback Property Name | Enabled Property Name | Notes |
419+
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- | ---------------------------- | -------------------------- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
420+
| `org.opencontainers.image.created` and `org.opencontainers.artifact.created` | The [RFC 3339](https://tools.ietf.org/html/rfc3339#section-5.6) format of the current UTC DateTime | | | `ContainerGenerateLabelsImageCreated` | |
421+
| `org.opencontainers.artifact.description` and `org.opencontainers.image.description` | | `ContainerDescription` | `Description` | `ContainerGenerateLabelsImageDescription` | |
422+
| `org.opencontainers.image.authors` | | `ContainerAuthors` | `Authors` | `ContainerGenerateLabelsImageAuthors` | |
423+
| `org.opencontainers.image.url` | | `ContainerInformationUrl` | `PackageProjectUrl` | `ContainerGenerateLabelsImageUrl` | |
424+
| `org.opencontainers.image.documentation` | | `ContainerDocumentationUrl` | `PackageProjectUrl` | `ContainerGenerateLabelsImageDocumentation` | |
425+
| `org.opencontainers.image.version` | | `ContainerVersion` | `PackageVersion` | `ContainerGenerateLabelsImageVersion` | |
426+
| `org.opencontainers.image.vendor` | | `ContainerVendor` | | `ContainerGenerateLabelsImageVendor` | |
427+
| `org.opencontainers.image.licenses` | | `ContainerLicenseExpression` | `PackageLicenseExpression` | `ContainerGenerateLabelsImageLicenses` | |
428+
| `org.opencontainers.image.title` | | `ContainerTitle` | `Title` | `ContainerGenerateLabelsImageTitle` | |
429+
| `org.opencontainers.image.base.name` | | `ContainerBaseImage` | | `ContainerGenerateLabelsImageBaseName` | |
430+
| `org.opencontainers.image.base.digest` | | | | `ContainerGenerateLabelsImageBaseDigest` | This will be the SHA digest of the chosen base image. Available from .NET SDK 9.0.100 onwards. |
431+
| `org.opencontainers.image.source` | | `PrivateRepositoryUrl` | | `ContainerGenerateLabelsImageSource` | Only written if `PublishRepositoryUrl` is `true`. Also relies on Sourcelink infrastructure being part of the build. |
432+
| `org.opencontainers.image.revision` | | `SourceRevisionId` | | `ContainerGenerateLabelsImageRevision` | Only written if `PublishRepositoryUrl` is `true`. Also relies on Sourcelink infrastructure being part of the build. |
419433

420434
## See also
421435

0 commit comments

Comments
 (0)