Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

Chapter 5. Running .NET Core 3.1 applications in containers


Use the ubi8/dotnet-31-runtime image to run a precompiled application inside a Linux container.

Prerequisites

  • Preconfigured containers.

    The following example uses podman.

Procedure

  1. Optional: If you are in another project’s directory and do not wish to create a nested project, return to the parent directory of the project:

    $ cd ..
  2. Create a new MVC project in a directory called mvc_runtime_example:

    $ dotnet new mvc --output mvc_runtime_example
  3. Publish the project:

    $ dotnet publish mvc_runtime_example -f netcoreapp3.1 -c Release
  4. Create the Dockerfile:

    $ cat > Dockerfile <<EOF
    FROM registry.access.redhat.com/ubi8/dotnet-31-runtime
    
    ADD bin/Release/netcoreapp3.1/publish/ .
    
    CMD ["dotnet", "mvc_runtime_example.dll"]
    EOF
  5. Build your image:

    $ podman build -t dotnet-31-runtime-example .
  6. Run your image:

    $ podman run -d -p8080:8080 dotnet-31-runtime-example

Verification steps

  • View the application running in the container:

    $ xdg-open http://127.0.0.1:8080
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat Dokumentation

Legal Notice

Theme

© 2026 Red Hat
Nach oben