centOS docker运行Asp.net Core程序

[root@localhost chenhua]# docker run -it --rm -p 8000:80 --name aspnetcore_sample microsoft/dotnet-samples:aspnetapp
Unable to find image 'microsoft/dotnet-samples:aspnetapp' locally
aspnetapp: Pulling from microsoft/dotnet-samples
a5a6f2f73cd8: Pull complete 
1e6f560accc2: Pull complete 
8176b77dc10d: Pull complete 
e21dd5015bb0: Pull complete 
10a7ec297783: Pull complete 
52c4b3af04fb: Pull complete 
Digest: sha256:de388b1ced92eadb906f806d0253d93c76cb92b0814798e7441c014b9645a32c
Status: Downloaded newer image for microsoft/dotnet-samples:aspnetapp
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {218e4f94-1b44-4c15-809b-f09ebcd45bf1} may be persisted to storage in unencrypted form.
Hosting environment: Production
Content root path: /app
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.

运行该段命令后:

首先查询宿主机本地是否存在microsoft/dotnet-samples:aspnetapp镜像

如不存在,则从远端拉取镜像

拉取成功后,运行指定命令,将Demo服务运行起来

此时我们在局域网的任意一台电脑浏览器中输入http://[宿主机IP]:8000 即可打开容器运行的demo

 

posted @ 2019-01-04 21:25  1936xinyang  阅读(223)  评论(0编辑  收藏  举报