根据微软官方教程(https://learn.microsoft.com/zh-cn/aspnet/core/host-and-deploy/docker/building-net-docker-images?view=aspnetcore-5.0) 进行操作,
在docker中创建镜像 docker build -t aspnetapp .
加载元数据失败。
根据提示信息,打开 mcr.microsoft.com 站点,拉取镜像,同样报错
Dockerfile 如下:
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /source
COPY aspnetapp/*.csproj .
RUN dotnet restore --use-current-runtime
COPY aspnetapp/. .
RUN dotnet publish -c Release -o /app --use-current-runtime --self-contained false --no-restore
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /app
COPY --from=build /app .
ENTRYPOINT ["dotnet", "aspnetapp.dll"]
PS(Docker在Win11中部署,依托于 Hyper-v)
有没有大神可以指点迷境 一下
关掉网络代理,如fanqiang,fastgithub等