当“ dockerizing”一个ASP.NET Core 3.1 MVC应用程序时,我得到以下结果:
docker run -dt -v "C:\Users\admin\vsdbg\vs2017u5:/remote_debugger:rw" -v "D:\xxx\yyy\Spikes\DockerizedWebApp1\DockerizedWebApp1:/app" -v "D:\xxx\yyy\Spikes\DockerizedWebApp1:/src/" -v "C:\Users\admin\.nuget\packages\:/root/.nuget/fallbackpackages2" -v "C:\Program Files\dotnet\sdk\NuGetFallbackFolder:/root/.nuget/fallbackpackages" -e "DOTNET_USE_POLLING_FILE_WATCHER=1" -e "ASPNETCORE_LOGGING__CONSOLE__DISABLECOLORS=true" -e "ASPNETCORE_ENVIRONMENT=Development" -e "NUGET_PACKAGES=/root/.nuget/fallbackpackages2" -e "NUGET_FALLBACK_PACKAGES=/root/.nuget/fallbackpackages;/root/.nuget/fallbackpackages2" -P --name DockerizedWebApp1 --entrypoint tail dockerizedwebapp1:dev -f /dev/null
docker: Error response from daemon: status code not OK but 500: {"Message":"Unhandled exception: Drive has not been shared"}.
See 'docker run --help'.
C:\Users\admin\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.10.6\build\Container.targets(198,5): error CTC1015: Docker command failed with exit code 125.
C:\Users\admin\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.10.6\build\Container.targets(198,5): error CTC1015: docker: Error response from daemon: status code not OK but 500: {"Message":"Unhandled exception: Drive has not been shared"}.
C:\Users\admin\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.10.6\build\Container.targets(198,5): error CTC1015: See 'docker run --help'.
C:\Users\admin\.nuget\packages\microsoft.visualstudio.azure.containers.tools.targets\1.10.6\build\Container.targets(198,5): error CTC1015: If the error persists, try restarting Docker Desktop.
不用说' docker run --help ' 根本没有帮助(缺少Docker文档中的链接/锚等)。
一些其他信息:
- VS2019脚手架无需任何修改即可应用。
- Docker镜像是Linux(我不能告诉我)。
- Docker版本是19.03.5,内部版本633a0ea
由于我不熟悉Linux,因此这个错误对我来说就像是一个“表演停止者”。也许未指示Linux安装驱动器?但是哪一个呢?该消息没有说明...
Windows可能必须共享驱动器,或将文件夹映射到需要共享的驱动器?该消息也没有说这...
这是Docker仪表板的屏幕截图:
这是Dockerfile:
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
WORKDIR /src
COPY ["DockerizedWebApp1/DockerizedWebApp1.csproj", "DockerizedWebApp1/"]
RUN dotnet restore "DockerizedWebApp1/DockerizedWebApp1.csproj"
COPY . .
WORKDIR "/src/DockerizedWebApp1"
RUN dotnet build "DockerizedWebApp1.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "DockerizedWebApp1.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "DockerizedWebApp1.dl"]
任何帮助将非常感激。提前致谢!