Skip to content

Merge main into live #39453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/z-customer-feedback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ body:
- Code doesn't work
- Missing information
- Outdated article
- Thank you
- Other (describe below)
validations:
required: true
Expand Down Expand Up @@ -63,4 +64,4 @@ body:
attributes:
label: Metadata
description: >-
Documentation metadata will be applied here for the PRMerger tool
Documentation metadata will be applied here for the PRMerger tool
5 changes: 5 additions & 0 deletions .openpublishing.redirection.core.json
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,11 @@
"source_path_from_root": "/docs/core/versions/version-history.md",
"redirect_url": "/dotnet/core/versions/selection"
},
{
"source_path_from_root": "/docs/core/whats-new/dotnet-8.md",
"redirect_url": "/dotnet/core/whats-new/dotnet-8/overview",
"redirect_document_id": true
},
{
"source_path_from_root": "/docs/core/whats-new/index.md",
"redirect_url": "/dotnet/core/whats-new/dotnet-7",
Expand Down
2 changes: 1 addition & 1 deletion docs/azure/includes/dotnet-all.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
| Mixed Reality Authentication | NuGet [1.2.0](https://www.nuget.org/packages/Azure.MixedReality.Authentication/1.2.0) | [docs](/dotnet/api/overview/azure/MixedReality.Authentication-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.MixedReality.Authentication_1.2.0/sdk/mixedreality/Azure.MixedReality.Authentication/) |
| Monitor Ingestion | NuGet [1.1.1](https://www.nuget.org/packages/Azure.Monitor.Ingestion/1.1.1) | [docs](/dotnet/api/overview/azure/Monitor.Ingestion-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Ingestion_1.1.1/sdk/monitor/Azure.Monitor.Ingestion/) |
| Monitor Query | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Monitor.Query/1.2.0)<br>NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Monitor.Query/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Monitor.Query-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.2.0/sdk/monitor/Azure.Monitor.Query/)<br>GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.3.0-beta.2/sdk/monitor/Azure.Monitor.Query/) |
| OpenAI Assistants | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.OpenAI.Assistants/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI.Assistants_1.0.0-beta.2/sdk/openai/Azure.AI.OpenAI.Assistants/) |
| OpenAI Assistants | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.OpenAI.Assistants/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.OpenAI.Assistants-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI.Assistants_1.0.0-beta.2/sdk/openai/Azure.AI.OpenAI.Assistants/) |
| OpenAI Inference | NuGet [1.0.0-beta.13](https://www.nuget.org/packages/Azure.AI.OpenAI/1.0.0-beta.13) | [docs](/dotnet/api/overview/azure/AI.OpenAI-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [1.0.0-beta.13](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_1.0.0-beta.13/sdk/openai/Azure.AI.OpenAI/) |
| OpenTelemetry AspNetCore | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.AspNetCore/1.1.0) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.AspNetCore-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.AspNetCore_1.1.0/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/) |
| OpenTelemetry Exporter | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Exporter/1.2.0) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.Exporter-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.Exporter_1.2.0/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/) |
Expand Down
2 changes: 1 addition & 1 deletion docs/azure/includes/dotnet-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
| Mixed Reality Authentication | NuGet [1.2.0](https://www.nuget.org/packages/Azure.MixedReality.Authentication/1.2.0) | [docs](/dotnet/api/overview/azure/MixedReality.Authentication-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.MixedReality.Authentication_1.2.0/sdk/mixedreality/Azure.MixedReality.Authentication/) |
| Monitor Ingestion | NuGet [1.1.1](https://www.nuget.org/packages/Azure.Monitor.Ingestion/1.1.1) | [docs](/dotnet/api/overview/azure/Monitor.Ingestion-readme) | GitHub [1.1.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Ingestion_1.1.1/sdk/monitor/Azure.Monitor.Ingestion/) |
| Monitor Query | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Monitor.Query/1.2.0)<br>NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Monitor.Query/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Monitor.Query-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.2.0/sdk/monitor/Azure.Monitor.Query/)<br>GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.Query_1.3.0-beta.2/sdk/monitor/Azure.Monitor.Query/) |
| OpenAI Assistants | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.OpenAI.Assistants/1.0.0-beta.2) | | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI.Assistants_1.0.0-beta.2/sdk/openai/Azure.AI.OpenAI.Assistants/) |
| OpenAI Assistants | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.AI.OpenAI.Assistants/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/AI.OpenAI.Assistants-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI.Assistants_1.0.0-beta.2/sdk/openai/Azure.AI.OpenAI.Assistants/) |
| OpenAI Inference | NuGet [1.0.0-beta.13](https://www.nuget.org/packages/Azure.AI.OpenAI/1.0.0-beta.13) | [docs](/dotnet/api/overview/azure/AI.OpenAI-readme?view=azure-dotnet-preview&amp;preserve-view=true) | GitHub [1.0.0-beta.13](https://github.com/Azure/azure-sdk-for-net/tree/Azure.AI.OpenAI_1.0.0-beta.13/sdk/openai/Azure.AI.OpenAI/) |
| OpenTelemetry AspNetCore | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.AspNetCore/1.1.0) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.AspNetCore-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.AspNetCore_1.1.0/sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/) |
| OpenTelemetry Exporter | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Monitor.OpenTelemetry.Exporter/1.2.0) | [docs](/dotnet/api/overview/azure/Monitor.OpenTelemetry.Exporter-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Monitor.OpenTelemetry.Exporter_1.2.0/sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/) |
Expand Down
2 changes: 1 addition & 1 deletion docs/core/compatibility/8.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,4 +162,4 @@ If you're migrating an app to .NET 8, the breaking changes listed here might aff

## See also

- [What's new in .NET 8](../whats-new/dotnet-8.md)
- [What's new in .NET 8](../whats-new/dotnet-8/overview.md)
2 changes: 1 addition & 1 deletion docs/core/deploying/trimming/incompatibilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The following table lists popular reflection-based serializers and their recomme
| Serializers | Alternative |
| :-- | :---------: |
| **Newtonsoft.Json** | [Source generated `System.Text.Json`](../../../standard/serialization/system-text-json/source-generation.md) |
| **System.Configuration.ConfigurationManager** | [Configuration-binding source generator](../../whats-new/dotnet-8.md#configuration-binding-source-generator) |
| **System.Configuration.ConfigurationManager** | [Configuration-binding source generator](../../whats-new/dotnet-8/runtime.md#configuration-binding-source-generator) |
| **System.Runtime.Serialization.Formatters.Binary.BinaryFormatter** | [Migrate away from BinaryFormatter serialization due to its security and reliability flaws.](../../compatibility/serialization/7.0/binaryformatter-apis-produce-errors.md#recommended-action) |

## Runtime code generation via JIT
Expand Down
2 changes: 1 addition & 1 deletion docs/core/docker/container-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,5 @@ _.NET Framework image repositories:_

## See also

- [What's new in .NET 8: Container images](../whats-new/dotnet-8.md#container-images)
- [What's new in .NET 8: Container images](../whats-new/dotnet-8/containers.md#container-images)
- [New approach for differentiating .NET 8+ images](https://github.com/dotnet/dotnet-docker/discussions/4821)
116 changes: 116 additions & 0 deletions docs/core/whats-new/dotnet-8/containers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
title: What's new in containers for .NET 8
description: Learn about the new containers features introduced in .NET 8.
titleSuffix: ""
ms.date: 11/14/2023
ms.topic: overview
ms.author: gewarren
author: gewarren
---
# What's new in containers for .NET 8

This article describes new features in containers for .NET 8.

## Container images

The following changes have been made to .NET container images for .NET 8:

- [Generated-image defaults](#generated-image-defaults)
- [Debian 12](#debian-12)
- [Non-root user](#non-root-user)
- [Chiseled Ubuntu images](#chiseled-ubuntu-images)
- [Build multi-platform container images](#build-multi-platform-container-images)
- [ASP.NET composite images](#aspnet-composite-images)

### Generated-image defaults

The new [`non-root` capability](#non-root-user) of the Microsoft .NET containers is now the default, which helps your apps stay secure-by-default. Change this default at any time by setting your own `ContainerUser`.

The default container tag is now `latest`. This default is in line with other tooling in the containers space and makes containers easier to use in inner development loops.

### Debian 12

The container images now use [Debian 12 (Bookworm)](https://wiki.debian.org/DebianBookworm). Debian is the default Linux distro in the .NET container images.

### Non-root user

Images include a `non-root` user. This user makes the images `non-root` capable. To run as `non-root`, add the following line at the end of your Dockerfile (or a similar instruction in your Kubernetes manifests):

```dockerfile
USER app
```

.NET 8 adds an environment variable for the UID for the `non-root` user, which is 64198. This environment variable is useful for the Kubernetes `runAsNonRoot` test, which requires that the container user be set via UID and not by name. This [dockerfile](https://github.com/dotnet/dotnet-docker/blob/e5bc76bca49a1bbf9c11e74a590cf6a9fe9dbf2a/samples/aspnetapp/Dockerfile.alpine-non-root#L27) shows an example usage.

The default port also changed from port `80` to `8080`. To support this change, a new environment variable `ASPNETCORE_HTTP_PORTS` is available to make it easier to change ports. The variable accepts a list of ports, which is simpler than the format required by `ASPNETCORE_URLS`. If you change the port back to port `80` using one of these variables, you can't run as `non-root`.

### Chiseled Ubuntu images

[Chiseled Ubuntu images](https://hub.docker.com/r/ubuntu/dotnet-deps) are available for .NET 8. Chiseled images have a reduced attacked surface because they're ultra-small, have no package manager or shell, and are `non-root`. This type of image is for developers who want the benefit of appliance-style computing. Chiseled images are published to the [.NET nightly artifact registry](https://mcr.microsoft.com/product/dotnet/nightly/aspnet/tags).

### Build multi-platform container images

Docker supports using and building [multi-platform images](https://docs.docker.com/build/building/multi-platform/) that work across multiple environments. .NET 8 introduces a new pattern that enables you to mix and match architectures with the .NET images you build. As an example, if you're using macOS and want to target an x64 cloud service in Azure, you can build the image by using the `--platform` switch as follows:

`docker build --pull -t app --platform linux/amd64`

The .NET SDK now supports `$TARGETARCH` values and the `-a` argument on restore. The following code snippet shows an example:

```dockerfile
RUN dotnet restore -a $TARGETARCH

# Copy everything else and build app.
COPY aspnetapp/. .
RUN dotnet publish -a $TARGETARCH --self-contained false --no-restore -o /app
```

For more information, see the [Improving multi-platform container support](https://devblogs.microsoft.com/dotnet/improving-multiplatform-container-support/) blog post.

### ASP.NET composite images

As part of an effort to improve containerization performance, new ASP.NET Docker images are available that have a composite version of the runtime. This composite is built by compiling multiple MSIL assemblies into a single ready-to-run (R2R) output binary. Because these assemblies are embedded into a single image, jitting takes less time, and the startup performance of apps improves. The other big advantage of the composite over the regular ASP.NET image is that the composite images have a smaller size on disk.

There is a caveat to be aware of. Since composites have multiple assemblies embedded into one, they have tighter version coupling. Apps can't use custom versions of framework or ASP.NET binaries.

Composite images are available for the Alpine Linux, Jammy Chiseled, and Mariner Distroless platforms from the `mcr.microsoft.com/dotnet/nightly/aspnet` repo. The tags are listed with the `-composite` suffix on the [ASP.NET Docker page](https://hub.docker.com/_/microsoft-dotnet-nightly-aspnet).

## Container publishing

- [Performance and compatibility](#performance-and-compatibility)
- [Authentication](#authentication)
- [Publish to tar.gz archive](#publish-to-targz-archive)

### Performance and compatibility

.NET 8 has improved performance for pushing containers to remote registries, especially Azure registries. Speedup comes from pushing layers in one operation and, for registries that don't support atomic uploads, a more reliable chunking mechanism.

These improvements also mean that more registries are supported: Harbor, Artifactory, Quay.io, and Podman.

### Authentication

.NET 8 adds support for OAuth token exchange authentication (Azure Managed Identity) when pushing containers to registries. This support means that you can now push to registries like Azure Container Registry without any authentication errors. The following commands show an example publishing flow:

```console
> az acr login -n <your registry name>
> dotnet publish -r linux-x64 -p PublishProfile=DefaultContainer
```

For more information containerizing .NET apps, see [Containerize a .NET app with dotnet publish](../../docker/publish-as-container.md).

### Publish to tar.gz archive

Starting in .NET 8, you can create a container directly as a *tar.gz* archive. This feature is useful if your workflow isn't straightforward and requires that you, for example, run a scanning tool over your images before pushing them. Once the archive is created, you can move it, scan it, or load it into a local Docker toolchain.

To publish to an archive, add the `ContainerArchiveOutputPath` property to your `dotnet publish` command, for example:

```dotnetcli
dotnet publish \
-p PublishProfile=DefaultContainer \
-p ContainerArchiveOutputPath=./images/sdk-container-demo.tar.gz
```

You can specify either a folder name or a path with a specific file name.

## See also

- [What's new in .NET 8](overview.md)
Loading