Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 5. Running .NET 10.0 applications in containers
Package your .NET application as a container image directly from the SDK and run it using Podman. This efficient workflow allows you to test your microservices on Red Hat Enterprise Linux without manually managing Dockerfiles.
You can use the ubi9/dotnet-100-aspnet image to run an ASP.NET Core application inside a Linux container.
For non-ASP.NET Core .NET applications, use the smaller ubi9/dotnet-100-runtime image.
Prerequisites
- You have installed .NET 10.0 SDK.
- You have installed Podman.
-
You have network access to the container registry specified in the
ContainerBaseImageattribute (registry.access.redhat.com).
Procedure
Create a new ASP.NET Core MVC project in a directory named
mvc_runtime_example:dotnet new mvc --output mvc_runtime_example
$ dotnet new mvc --output mvc_runtime_exampleCopy to Clipboard Copied! Toggle word wrap Toggle overflow Publish the project:
dotnet publish mvc_runtime_example -f net10.0 /p:PublishProfile=DefaultContainer /p:ContainerBaseImage=registry.access.redhat.com/ubi9/dotnet-100-aspnet:latest
$ dotnet publish mvc_runtime_example -f net10.0 /p:PublishProfile=DefaultContainer /p:ContainerBaseImage=registry.access.redhat.com/ubi9/dotnet-100-aspnet:latestCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run your image:
podman run --rm -p 8080:8080 mvc_runtime_example
$ podman run --rm -p 8080:8080 mvc_runtime_exampleCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
View the application running in the container:
xdg-open http://127.0.0.1:8080
$ xdg-open http://127.0.0.1:8080Copy to Clipboard Copied! Toggle word wrap Toggle overflow