Search

Chapter 5. Running .NET 8.0 applications in containers

download PDF

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

The following example uses podman.

Procedure

  1. Create a new MVC project in a directory called mvc_runtime_example:

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

    $ dotnet publish mvc_runtime_example -f net8.0 /p:PublishProfile=DefaultContainer /p:ContainerBaseImage=registry.access.redhat.com/ubi8/dotnet-80-runtime:latest
  3. Run your image:

    $ podman run --rm -p8080:8080 mvc_runtime_example

Verification steps

  • View the application running in the container:

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

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.