Docker ADD 命令产生 'cannot find the file' 错误
Docker ADD command produces 'cannot find the file' error
我正在尝试使用 docker-compose 项目类型将我的几个微服务移动到 docker 容器中 Visual Studio。
我还有 Service Fabric 项目,所以我必须将 Service Fabric SDK 安装到我的 docker 容器中。
我就是这样做的(我的 docker 文件):
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 80
...
WORKDIR /temp
ADD https://aka.ms/vs/15/release/vs_buildtools.exe /temp #C:\TEMP\vs_buildtools.exe
...
其余代码无关紧要,因为它会在使用 ADD 命令时崩溃。
我通过 Ctrl+F5 运行 后输出的错误:
3>Step 4/11 : ADD https://aka.ms/vs/15/release/vs_buildtools.exe /temp
3>Service 'bmt.microservices.snowforecastcenter' failed to build: ADD failed: CreateFile \?\C:\ProgramData\Docker\tmp\docker-builder567273413\temp: The system cannot find the file specified.
我不明白我做错了什么,这意味着什么 'system cannot find the file' 因为我只是从互联网上加载文件并将其放入我新创建的 \temp 文件夹(link 有效,我检查过)。
有人知道这可能与什么有关吗?
好的,我通过将评论移到下一行不小心解决了这个问题。
来自这里:
ADD https://aka.ms/vs/15/release/vs_buildtools.exe /temp #C:\TEMP\vs_buildtools.exe
为此:
ADD https://aka.ms/vs/15/release/vs_buildtools.exe /temp
#C:\TEMP\vs_buildtools.exe
然后我在官方网站 (https://docs.docker.com/engine/reference/builder/#/from) 上说你不能有内联评论,因为它们被视为参数:
Docker treats lines that begin with # as a comment, unless the line is a valid parser directive. A # marker anywhere else in a line is treated as an argument.
我希望这对 Docker 的其他新人有所帮助。
我正在尝试使用 docker-compose 项目类型将我的几个微服务移动到 docker 容器中 Visual Studio。
我还有 Service Fabric 项目,所以我必须将 Service Fabric SDK 安装到我的 docker 容器中。
我就是这样做的(我的 docker 文件):
FROM mcr.microsoft.com/dotnet/core/aspnet:2.2-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 80
...
WORKDIR /temp
ADD https://aka.ms/vs/15/release/vs_buildtools.exe /temp #C:\TEMP\vs_buildtools.exe
...
其余代码无关紧要,因为它会在使用 ADD 命令时崩溃。 我通过 Ctrl+F5 运行 后输出的错误:
3>Step 4/11 : ADD https://aka.ms/vs/15/release/vs_buildtools.exe /temp
3>Service 'bmt.microservices.snowforecastcenter' failed to build: ADD failed: CreateFile \?\C:\ProgramData\Docker\tmp\docker-builder567273413\temp: The system cannot find the file specified.
我不明白我做错了什么,这意味着什么 'system cannot find the file' 因为我只是从互联网上加载文件并将其放入我新创建的 \temp 文件夹(link 有效,我检查过)。
有人知道这可能与什么有关吗?
好的,我通过将评论移到下一行不小心解决了这个问题。
来自这里:
ADD https://aka.ms/vs/15/release/vs_buildtools.exe /temp #C:\TEMP\vs_buildtools.exe
为此:
ADD https://aka.ms/vs/15/release/vs_buildtools.exe /temp
#C:\TEMP\vs_buildtools.exe
然后我在官方网站 (https://docs.docker.com/engine/reference/builder/#/from) 上说你不能有内联评论,因为它们被视为参数:
Docker treats lines that begin with # as a comment, unless the line is a valid parser directive. A # marker anywhere else in a line is treated as an argument.
我希望这对 Docker 的其他新人有所帮助。