打开Visual Studio 2019新建“适用于Kubernetes的容器应用程序”
一路下一步。新建完成。
选择Kubernetes运行。显示了两个网页,运行正常。
选择Docker。提醒Docker当前运行的Windows容器方式,需要改变为Linux容器方式。
切换容器。
然后运行……
输出窗口提示:
PS C:\Users\XXX> docker pull mcr.microsoft.com/dotnet/core/aspnet:2.2
2.2: Pulling from dotnet/core/runtime
e46172273a4e: Pulling fs layer
8f7ed89f9e35: Pulling fs layer
db942f597f85: Pulling fs layer
13f6b6d2a0ea: Pulling fs layer
eb4cbcb5a835: Pulling fs layer
c08512d3ce12: Pulling fs layer
f51cb25e0815: Pulling fs layer
13f6b6d2a0ea: Waiting
eb4cbcb5a835: Waiting
c08512d3ce12: Waiting
f51cb25e0815: Waiting
然后就没反应了!
后来发现不是没反应,是下载镜像文件太慢。
打开powershell或运行CMD,手动下载(用了2个小时左右时间,下载了.net的三个基本镜像:
PS C:\Users\XXX> docker pull mcr.microsoft.com/dotnet/core/runtime:2.2
2.2: Pulling from dotnet/core/runtime……
Digest: sha256:28b78d0807731a33a2f9d0682bc8cc8db864817d0758e847d588ee7438710919
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/runtime:2.2
mcr.microsoft.com/dotnet/core/runtime:2.2
PS C:\Users\XXX> docker pull mcr.microsoft.com/dotnet/core/sdk:2.2
2.2: Pulling from dotnet/core/sdk
e46172273a4e: Already exists
8f7ed89f9e35: Already exists……
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/sdk:2.2
mcr.microsoft.com/dotnet/core/sdk:2.2
PS C:\Users\XXX> docker pull mcr.microsoft.com/dotnet/core/aspnet:2.2
2.2: Pulling from dotnet/core/aspnet
e46172273a4e: Already exists……
Digest: sha256:ed8e7b6ead50dedabb927e6f408cce46e029cb47e82f5bf61e3b853e86a980f5
Status: Downloaded newer image for mcr.microsoft.com/dotnet/core/aspnet:2.2
mcr.microsoft.com/dotnet/core/aspnet:2.2
再次运行Docker。提示需共享本地硬盘。
共享后,运行成功!