FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 8000
EXPOSE 80
FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build
WORKDIR /src
COPY ["Crontab/Crontab.csproj", "Crontab/"]
COPY ["CrontabService/CrontabService.csproj", "CrontabService/"]
COPY ["Common/Common.csproj", "Common/"]
RUN dotnet restore "Crontab/Crontab.csproj"
COPY . .
WORKDIR "/src/Crontab"
RUN dotnet build "Crontab.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "Crontab.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY *.* ./
ENTRYPOINT ["dotnet", "Crontab.dll"]
以上是我的dockerfile文件
失败原因如下
Step 7/19 : COPY ["./Crontab/Crontab.csproj", "Crontab/"]
COPY failed: stat /var/lib/docker/tmp/docker-builder806754089/Crontab/Crontab.csproj: no such file or directory
如果放在和目录同级问题是
Step 7/19 : COPY ["Crontab/Crontab.csproj", "/src"]
COPY failed: Forbidden path outside the build context: Crontab/Crontab.csproj ()
此时我将dockerfile挪到上一个文件夹也是失败,
相关问题
- Docker task in Azure devops won't accept "$(pw
- Unable to run mariadb when mount volume
- Unspecified error (0x80004005) while running a Doc
- What would prevent code running in a Docker contai
- How to reload apache in php-apache docker containe
这种情况一般说来是因为大小写问题造成的,Windows 的文件和文件夹是大小写无关,而Linux不是。
Crontab/Crontab.csproj 看看是不是第一个字母小写了。
试试
COPY ["src/Crontab/Crontab.csproj", "Crontab/"]