dotnet / dotnet/sdk

Support zstd compression for oci/docker image layers

Open
#52,244 5 comments 2 reactions 0 assignees View on GitHub
Area-Containers
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Is your feature request related to a problem? Please describe.

I am currently updating my build tooling to use the dotnet SDK to build and publish containers. So far this has been excellent and easy to use.

Docker recently announced that their [hardened images](https://www.docker.com/products/hardened-images/) are now free. I attempted to use the hardened image by setting the `ContainerBaseImage` property in my csproj
```xml



dhi.io/dotnet:8-alpine3.22

```
However, when my publish has ran I get the following error:
```cmd
Products.EventsListener.Service net8.0 failed with 1 error(s) (2.7s)
C:\Program Files\dotnet\sdk\10.0.101\Containers\build\Microsoft.NET.Build.Containers.targets(261,5): error CONTAINER2001: Unrecognized mediaType 'application/vnd.oci.image.layer.v1.tar+zstd'.
```

After reviewing the code base I found the [SchemaTypes](https://github.com/dotnet/sdk/blob/main/src/Containers/Microsoft.NET.Build.Containers/Registry/SchemaTypes.cs#L7) class does not have the given media type - and can see two locations in code where this can cause the error to be thrown
- https://github.com/dotnet/sdk/blob/main/src/Containers/Microsoft.NET.Build.Containers/Layer.cs#L207
- https://github.com/dotnet/sdk/blob/main/src/Containers/Microsoft.NET.Build.Containers/ContentStore.cs#L53

### Describe the solution you'd like
To have support added for the `application/vnd.oci.image.layer.v1.tar+zstd` media type so that the hardened images can be used within the container build features of the SDK.

### Additional context
- Despite targeting a net8 build I am using the 10.0.100 sdk

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.