Skip to content

Commit adaa15c

Browse files
lbussellmthalman
andauthored
Add instructions for using lifecycle annotations (#6239)
Co-authored-by: Matt Thalman <[email protected]>
1 parent 08e7f8d commit adaa15c

File tree

2 files changed

+44
-82
lines changed

2 files changed

+44
-82
lines changed

documentation/scripts/check-tag-support.ps1

Lines changed: 0 additions & 68 deletions
This file was deleted.

documentation/vulnerability-reporting.md

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ Prerequisites:
99
* Dockerfile of the container image being reported upon
1010
* Name of the .NET image the Dockerfile is based on (e.g. `mcr.microsoft.com/dotnet/aspnet:8.0`)
1111
* Architecture of the container image being reported upon (e.g. `amd64`)
12-
* [Docker installation](https://docs.docker.com/desktop) to run commands locally
12+
* [Docker](https://docs.docker.com/desktop)
13+
* [ORAS CLI](https://oras.land/)
14+
* [`jq`](https://jqlang.org/), [PowerShell](https://github.com/PowerShell/PowerShell), or Windows PowerShell
1315
* Whether the container image is a [Linux or Windows image](#how-can-i-determine-whether-my-image-is-based-on-linux-or-windows)
1416
* For Linux images, it's also important to [know the Linux distro and version](#how-can-i-determine-the-os-version-of-a-linux-image) (e.g. `Debian Bookworm`, `Alpine 3.20`, `Ubuntu Noble`, `Azure Linux 3.0`)
1517
* If you're using Docker Desktop for Windows and investigating a vulnerability in a Linux image, [change your settings](https://docs.docker.com/desktop/settings/windows/) to target Linux containers.
@@ -120,9 +122,8 @@ Rerun the scan of your image using your scanning tool. Ensure you get the latest
120122
When .NET drops support for an image tag, it means it will no longer be updated, even when there is a new base OS image available.
121123
This means that vulnerabilities will be reported for that image over time if it continues to be used.
122124
Our [supported tag policy](supported-tags.md) provides detailed information about when these tags are no longer supported.
123-
The simple rule to follow: only the tags shown in our tag listing are supported:
124125

125-
Complete tag lists:
126+
The simple rule to follow: only the tags shown in our full tag listings are supported:
126127

127128
* [runtime-deps](../README.runtime-deps.md#full-tag-listing)
128129
* [runtime](../README.runtime.md#full-tag-listing)
@@ -134,25 +135,54 @@ Complete tag lists:
134135
* [samples](../README.samples.md#full-tag-listing)
135136
* [Microsoft Artifact Registry](https://mcr.microsoft.com/en-us/catalog?search=dotnet/)
136137

137-
This script can be used to determine if the .NET image tag is supported:
138+
#### Image Lifecycle Annotations
138139

139-
#### macOS/Linux
140+
When .NET images or tags go out of support, a lifecycle annotation is added to the registry indicating that the image has reached end-of-life.
141+
The following command will output the latest lifecycle artifact associated with a .NET image.
140142

141-
Requires [PowerShell to be installed](https://learn.microsoft.com/powershell/scripting/install/installing-powershell-on-linux).
143+
##### macOS/Linux (sh)
142144

143-
```shell
144-
dotnetImage="<insert-dotnet-image-tag>" # example: mcr.microsoft.com/dotnet/aspnet:8.0
145-
curl -sSL https://raw.githubusercontent.com/dotnet/dotnet-docker/main/documentation/scripts/check-tag-support.ps1 | pwsh /dev/stdin $dotnetImage
145+
```sh
146+
dotnetImage="<insert-dotnet-image-tag>" # example EOL image: mcr.microsoft.com/dotnet/aspnet:6.0
147+
oras discover \
148+
--format "json" \
149+
--artifact-type "application/vnd.microsoft.artifact.lifecycle" \
150+
$dotnetImage \
151+
| jq '.manifests | sort_by(.annotations."org.opencontainers.image.created") | reverse | first'
146152
```
147153

148-
#### Windows
154+
##### PowerShell (any platform)
149155

150-
```powershell
151-
$dotnetImage="<insert-dotnet-image-tag>" # example: mcr.microsoft.com/dotnet/aspnet:8.0
152-
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
153-
&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/dotnet/dotnet-docker/main/documentation/scripts/check-tag-support.ps1'))) $dotnetImage
156+
```pwsh
157+
$dotnetImage = "<insert-dotnet-image-tag>" # example EOL image: mcr.microsoft.com/dotnet/aspnet:6.0
158+
$artifacts = oras discover --format "json" --artifact-type "application/vnd.microsoft.artifact.lifecycle" $dotnetImage | ConvertFrom-Json
159+
$artifacts.manifests | Sort-Object { $_.annotations.'org.opencontainers.image.created' } -Descending | Select-Object -First 1
154160
```
155161

162+
##### Output
163+
164+
If the image has no lifecycle manifest attached, then there will be no output.
165+
This means the image is supported and a newer image has not been released yet.
166+
However, if the image has a lifecycle manifest attached and it contains an end-of-life date, the image is unsupported.
167+
168+
For example:
169+
170+
```json
171+
{
172+
"reference": "mcr.microsoft.com/dotnet/aspnet@sha256:6e81022bab60ff3ce884cc118115d5394341d5ddf95dede357d2e17ea8920074",
173+
"mediaType": "application/vnd.oci.image.manifest.v1+json",
174+
"digest": "sha256:6e81022bab60ff3ce884cc118115d5394341d5ddf95dede357d2e17ea8920074",
175+
"size": 788,
176+
"annotations": {
177+
"org.opencontainers.image.created": "2025-01-14T05:32:10Z",
178+
"vnd.microsoft.artifact.lifecycle.end-of-life.date": "2024-11-12"
179+
},
180+
"artifactType": "application/vnd.microsoft.artifact.lifecycle"
181+
}
182+
```
183+
184+
The lifecycle artifact above indicates that the image `mcr.microsoft.com/dotnet/aspnet@sha256:6e81022b...` reached end of life on `2024-11-12`.
185+
156186
#### Response
157187

158188
* `Yes`: go to "[E. Is your image built from the latest .NET image?](#e-is-your-image-built-from-the-latest-net-image)"

0 commit comments

Comments
 (0)