第5章 コンテナーでの .NET 9.0 アプリケーションの実行
ubi8/dotnet-90-runtime
イメージを使用して、.NET コンテナーで事前コンパイルされたアプリケーションを実行します。
以下の例では Podman を使用しています。
手順
mvc_runtime_example
という名前のディレクトリーに新しい MVC プロジェクトを作成します。dotnet new mvc --output mvc_runtime_example
$ dotnet new mvc --output mvc_runtime_example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow プロジェクトを公開します。
dotnet publish mvc_runtime_example -f net9.0 /p:PublishProfile=DefaultContainer /p:ContainerBaseImage=registry.access.redhat.com/ubi8/dotnet-90-runtime:latest
$ dotnet publish mvc_runtime_example -f net9.0 /p:PublishProfile=DefaultContainer /p:ContainerBaseImage=registry.access.redhat.com/ubi8/dotnet-90-runtime:latest
Copy to Clipboard Copied! Toggle word wrap Toggle overflow イメージを実行します。
podman run -rm -p8080:8080 mvc_runtime_example
$ podman run -rm -p8080:8080 mvc_runtime_example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow コンテナーで実行されているアプリケーションを表示します。
xdg-open http://127.0.0.1:8080
$ xdg-open http://127.0.0.1:8080
Copy to Clipboard Copied! Toggle word wrap Toggle overflow