Docker Windows 不支持 COPY --from?
Docker on Windows does not support COPY --from?
我正在尝试使用这个 Docker 构造:
Optionally a name can be given to a new build stage by adding AS name
to the FROM instruction. The name can be used in subsequent FROM and
COPY --from= instructions to refer to the image built in
this stage.
但我收到这条消息:
COPY failed: stat /var/lib/docker/tmp/docker-builder869050639/-–from=build-env:
no such file or directory
Docker Windows 17.09.0-ce-win33 (13620) 是否支持从前一阶段复制文件?这是 Docker 文件:
FROM microsoft/dotnet:2.0-sdk AS build-env
WORKDIR /app
COPY ./ ./
RUN dotnet build ProviderApi.csproj
RUN dotnet publish ProviderApi.csproj -c Release -r linux-x64 -o out
FROM microsoft/dotnet:2.0-runtime-deps
WORKDIR /app
COPY -–from=build-env /app/out/ ./
EXPOSE 80
ENTRYPOINT ["./ProviderApi"]
你试过小写吗"as"? (似乎不太可能,我看到了两者的例子)
FROM microsoft/dotnet:2.0-sdk as build-env
或更基本的
FROM microsoft/dotnet:2.0-sdk
COPY -–from=0 /app/out/ ./
问题是最终构建阶段的 docker 图像中没有目标目录。这是供将来参考的工作 Dockerfile。
FROM microsoft/aspnetcore-build:2.0.3-stretch AS build-env
WORKDIR /app
COPY . ./
RUN dotnet build ProviderApi.csproj
RUN dotnet publish ProviderApi.csproj -c Release -r linux-x64 -o out
FROM microsoft/aspnetcore:2.0.3-stretch
RUN mkdir /app
COPY --from=build-env /app/out /app
ENV ASPNETCORE_URLS=http://+:5001
EXPOSE 5001
ENTRYPOINT ["/app/ProviderApi"]
我正在尝试使用这个 Docker 构造:
Optionally a name can be given to a new build stage by adding AS name to the FROM instruction. The name can be used in subsequent FROM and COPY --from= instructions to refer to the image built in this stage.
但我收到这条消息:
COPY failed: stat /var/lib/docker/tmp/docker-builder869050639/-–from=build-env:
no such file or directory
Docker Windows 17.09.0-ce-win33 (13620) 是否支持从前一阶段复制文件?这是 Docker 文件:
FROM microsoft/dotnet:2.0-sdk AS build-env
WORKDIR /app
COPY ./ ./
RUN dotnet build ProviderApi.csproj
RUN dotnet publish ProviderApi.csproj -c Release -r linux-x64 -o out
FROM microsoft/dotnet:2.0-runtime-deps
WORKDIR /app
COPY -–from=build-env /app/out/ ./
EXPOSE 80
ENTRYPOINT ["./ProviderApi"]
你试过小写吗"as"? (似乎不太可能,我看到了两者的例子)
FROM microsoft/dotnet:2.0-sdk as build-env
或更基本的
FROM microsoft/dotnet:2.0-sdk
COPY -–from=0 /app/out/ ./
问题是最终构建阶段的 docker 图像中没有目标目录。这是供将来参考的工作 Dockerfile。
FROM microsoft/aspnetcore-build:2.0.3-stretch AS build-env
WORKDIR /app
COPY . ./
RUN dotnet build ProviderApi.csproj
RUN dotnet publish ProviderApi.csproj -c Release -r linux-x64 -o out
FROM microsoft/aspnetcore:2.0.3-stretch
RUN mkdir /app
COPY --from=build-env /app/out /app
ENV ASPNETCORE_URLS=http://+:5001
EXPOSE 5001
ENTRYPOINT ["/app/ProviderApi"]