Run .NET applications in containerized environments
You can build and run .NET applications in containers by using Podman, migrate existing applications to the latest .NET version, and configure environment variables to control the container build behavior.
Run .NET 10.0 applications in containers Copy linkLink copied!
To run .NET applications in an isolated environment, build container images directly from the .NET SDK and run them by using Podman.
Before you begin Copy linkLink copied!
- 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).
About this task Copy linkLink copied!
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.
Procedure Copy linkLink copied!
Results Copy linkLink copied!
- View the application running in the container:
$ xdg-open http://127.0.0.1:8080
Migrate from previous versions of .NET Copy linkLink copied!
To benefit from the latest performance improvements and long-term support, upgrade your existing applications to .NET 10.0. You can migrate from earlier .NET versions or port code from the .NET Framework to modernize your workloads.
Migration guidance for .NET Copy linkLink copied!
Microsoft provides detailed guidance for migrating between different versions of .NET and ASP.NET Core. If you are upgrading from an older .NET version, refer to the official Microsoft documentation for your specific upgrade path.
The following resources provide migration guidance for specific upgrade paths:
- Migrate from ASP.NET Core 9.0 to 10.0
- Migrate from ASP.NET Core 8.0 to 9.0
- Migrate from ASP.NET Core 7.0 to 8.0
- Migrate from ASP.NET Core 6.0 to 7.0
- Migrate from ASP.NET Core 5.0 to 6.0
- Migrate from ASP.NET Core 3.1 to 5.0
- Migrate from ASP.NET Core 3.0 to 3.1
- Migrate from ASP.NET Core 2.2 to 3.0
- Migrate from ASP.NET Core 2.1 to 2.2
- Migrate from .NET Core 2.0 to 2.1
- Migrate from ASP.NET to ASP.NET Core
- Migrating .NET Core projects from project.json
- Migrate from project.json to .csproj format
Port from .NET Framework Copy linkLink copied!
When migrating an application from .NET Framework, refer to the official Microsoft documentation.
The following resources provide guidance for porting from .NET Framework:
- General guidelines: Porting to .NET Core from .NET Framework
- Porting libraries: Porting to .NET Core - Libraries
- Migrating to ASP.NET Core: Migrating to ASP.NET Core
Some technologies and APIs from .NET Framework are not available in .NET Core or .NET. If your application or library depends on these APIs, you must either find an alternative or remain on .NET Framework.
.NET Core and .NET do not support the following technologies:
- Desktop applications, such as Windows Forms and Windows Presentation Foundation (WPF)
- Windows Communication Foundation (WCF) servers (WCF clients are supported)
- .NET remoting
Additionally, some .NET APIs are specific to Microsoft Windows environments and are not cross-platform. Examples of these Windows-specific APIs include:
-
Microsoft.Win32.Registry -
System.AppDomains -
System.Security.Principal.Windows
Some APIs that are not supported by default in .NET are available in the Microsoft.Windows.Compatibility NuGet package.
Use this package with caution. Many of the APIs it provides, such as Microsoft.Win32.Registry, only work on Windows. Using these APIs makes your application incompatible with Red Hat Enterprise Linux.
Environment variables for Source-to-Image Copy linkLink copied!
The .NET images support several environment variables to control the build behavior of your .NET application. You can set these variables as part of the build configuration, or add them to the .s2i/environment file in the application source code repository.
Configuration variables
DOTNET_STARTUP_PROJECT
|
|
DOTNET_ASSEMBLY_NAME
|
|
DOTNET_PUBLISH_READYTORUN
|
|
DOTNET_RESTORE_SOURCES
|
|
DOTNET_RESTORE_CONFIGFILE
|
|
DOTNET_TOOLS
|
|
DOTNET_TEST_PROJECTS
|
|
DOTNET_CONFIGURATION
|
|
DOTNET_VERBOSITY
|
|
HTTP_PROXY / HTTPS_PROXY
|
|
DOTNET_RM_SRC
|
|
SSL_CERT_DIR
|
|
ASPNETCORE_URLS
|
|
DOTNET_RESTORE_DISABLE_PARALLEL
|
|
DOTNET_INCREMENTAL
|
|
DOTNET_PACK
|
|