.NET Core Docker 示例

以下示例和指南演示了如何使用.NET Core和Docker进行开发,测试和生产。 您可以将样本用作自己的Docker映像的基础,或者只是学习而已。

 

构建映像

 

构建.NET Core Docker映像   (  https://github.com/dotnet/dotnet-docker/blob/master/samples/dotnetapp/README.md )

构建ASP.NET Core Docker映像   ( https://github.com/dotnet/dotnet-docker/blob/master/samples/aspnetapp/README.md )

构建和测试多项目解决方案    ( https://github.com/dotnet/dotnet-docker/blob/master/samples/complexapp/README.md  )

 

 

开发指导

 

建立Docker环境  ( https://github.com/dotnet/dotnet-docker/blob/master/samples/establishing-docker-environment.md )

选择.NET Core 映像标签 (  https://github.com/dotnet/dotnet-docker/blob/master/samples/selecting-tags.md )

在容器中运行测试  (  https://github.com/dotnet/dotnet-docker/blob/master/samples/run-tests-in-sdk-container.md )

在SDK容器中构建 ( https://github.com/dotnet/dotnet-docker/blob/master/samples/build-in-sdk-container.md )

在SDK容器中运行应用程序  (  https://github.com/dotnet/dotnet-docker/blob/master/samples/run-in-sdk-container.md )

使用Docker和HTTPS在开发中运行ASP.NET Core应用程序  ( https://github.com/dotnet/dotnet-docker/blob/master/samples/run-aspnetcore-https-development.md  )

 

 

托管指导

 

使用Docker和HTTPS托管ASP.NET Core映像  ( https://github.com/dotnet/dotnet-docker/blob/master/samples/host-aspnetcore-https.md )

将Docker映像推送到Azure容器注册表  ( https://github.com/dotnet/dotnet-docker/blob/master/samples/push-image-to-acr.md )

将Docker映像推送到Docker Hub (  https://github.com/dotnet/dotnet-docker/blob/master/samples/push-image-to-dockerhub.md )

将ASP.NET Core应用程序部署到Azure容器实例  ( https://github.com/dotnet/dotnet-docker/blob/master/samples/deploy-container-to-aci.md )

 

 

示例片段

除了完全可操作的示例项目之外,还提供了代码片段  (https://github.com/dotnet/dotnet-docker/blob/master/samples/snippets  )以演示更具体的场景。

 

在 Docker 场景中管理 NuGet 凭证   ( https://github.com/dotnet/dotnet-docker/blob/master/samples/snippets/nuget-credentials.md  )

在Dockerfile中安装.NET Core  ( https://github.com/dotnet/dotnet-docker/blob/master/samples/snippets/installing-dotnet.md )

在Docker容器中使用System.Drawing.Common软件包   (  https://github.com/dotnet/dotnet-docker/blob/master/samples/snippets/using-system-drawing-common.md )

 

尝试预建映像

 

以下命令将在容器中运行.NET Core控制台应用程序:

1 docker run --rm mcr.microsoft.com/dotnet/core/samples

 

以下命令将在一个容器中运行ASP.NET Core控制台应用程序,您可以在Web浏览器中访问该容器,网址为 http://localhost:8000

1 docker run --rm -it -p 8000:80 mcr.microsoft.com/dotnet/core/samples:aspnetapp

 

 

Docker储存库

 

您可以在以下Docker存储库中找到.NET容器映像:

dotnet/core:  .NET Core    ( https://hub.docker.com/_/microsoft-dotnet-core/ )

dotnet/framework: .NET Framework   (https://hub.docker.com/_/microsoft-dotnet-framework/)

 

posted @ 2020-03-10 22:50  TonysDad  阅读(327)  评论(0编辑  收藏  举报