我有一个非常基本的疑问。因此,我在VS 2019 Professional Edition中创建了一个ASP.Net Web应用程序,并保留了对Docker支持的勾选标记。结果,它在文件下面创建。
FROM mcr.microsoft.com/dotnet/framework/aspnet:4.7.2-windowsservercore-1803
ARG source
ENV AWS_REGION="us-east-1"
WORKDIR /inetpub/wwwroot
COPY ${source:-obj/Docker/publish} .
当我转到VS并单击Docker Button运行该解决方案时,Docker会构建映像并成功打开网站,然后在输出窗口中看到以下内容。
========== Checking for Container Prerequisites ==========
Verifying that Docker Desktop is installed...
Docker Desktop is installed.
========== Verifying that Docker Desktop is running... ==========
Verifying that Docker Desktop is running...
Docker Desktop is running.
========== Verifying Docker OS ==========
Verifying that Docker Desktop's operating system mode matches the project's target operating system...
Docker Desktop's operating system mode matches the project's target operating system.
========== Pulling Required Images ==========
Checking for missing Docker images...
Docker images are ready.
========== Warming up container(s) for Sample ==========
Starting up container(s)...
docker run -dt -v "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\Remote Debugger:C:\remote_debugger:ro" -v "C:\Users\HOLLA\source\repos\Sample\Sample:C:\inetpub\wwwroot" -e "DEV_ENVIRONMENT=1" -e "VBCSCOMPILER_TTL=604800" -P --entrypoint cmd sample:dev /c "start /B C:\ServiceMonitor.exe w3svc & C:\remote_debugger\x64\msvsmon.exe /noauth /anyuser /silent /nostatus /noclrwarn /nosecuritywarn /nofirewallwarn /nowowwarn /fallbackloadremotemanagedpdbs /timeout:2147483646"
97cb8a84de3859acb833b54ec09c591cd44779e95569be97aa479704ae2264d4
太好了。
现在,我想手动构建相同的docker映像,因此从Powershell中运行以下命令
docker build -t foo .
下面是我得到的
Sending build context to Docker daemon 3.584kB
Step 1/5 : FROM mcr.microsoft.com/dotnet/framework/aspnet:4.7.2-windowsservercore-1803
---> d58c3fe3a54e
Step 2/5 : ARG source
---> Using cache
---> 2e9c18b9c20b
Step 3/5 : ENV AWS_REGION="us-east-1"
---> Using cache
---> e19bb52acd5f
Step 4/5 : WORKDIR /inetpub/wwwroot
---> Using cache
---> 5a4154a1648c
Step 5/5 : COPY ${source:-obj/Docker/publish} .
COPY failed: CreateFile \\?\C:\ProgramData\Docker\tmp\docker-builder605842426\obj\Docker\publish: The system cannot find the file specified.
我的问题
为什么在最后一行显示 COPY_FAILED 却找不到文件路径的情况下出现异常。即使是VS Docker构建,也将使用相同的docker文件。请指导我。有什么不同和怎么了?