搜索

第 5 章 在容器中运行 .NET 8.0 应用程序

download PDF

使用 ubi8/dotnet-80-runtime 镜像在 Linux 容器中运行 .NET 应用程序。

以下示例使用 podman。

流程

  1. 在名为 mvc_runtime_example 的目录中创建一个新的 MVC 项目:

    $ dotnet new mvc --output mvc_runtime_example
  2. 发布项目:

    $ dotnet publish mvc_runtime_example -f net8.0 /p:PublishProfile=DefaultContainer /p:ContainerBaseImage=registry.access.redhat.com/ubi8/dotnet-80-runtime:latest
  3. 运行您的镜像:

    $ podman run --rm -p8080:8080 mvc_runtime_example

验证步骤

  • 查看在容器中运行的应用程序:

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

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.