Chapter 5. Running .NET 6.0 applications in containers
Chapter 5. Running .NET 6.0 applications in containers Use the ubi8/dotnet-60-runtime image to run a precompiled application inside a Linux container. Prerequisites Preconfigured containers. The following example uses podman. Procedure 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: Create a new MVC project in a directory called mvc_runtime_example : Publish the project: Create the Dockerfile : Build your image: Run your image: Verification steps View the application running in the container:
cd .. dotnet new mvc --output mvc_runtime_example dotnet publish mvc_runtime_example -f net6.0 -c Release cat > Dockerfile <<EOF FROM registry.access.redhat.com/ubi8/dotnet-60-runtime ADD bin/Release/net6.0/publish/ . CMD ["dotnet", "mvc_runtime_example.dll"] EOF podman build -t dotnet-60-runtime-example . podman run -d -p8080:8080 dotnet-60-runtime-example xdg-open http://127.0.0.1:8080