Docker - 打开 /var/lib/docker/overlay2/xxx/merged/etc/passwd: 没有那个文件或目录
Docker - open /var/lib/docker/overlay2/xxx/merged/etc/passwd: no such file or directory
我正在尝试 'docker build -t aspnetapp .'
但它停止并在下面显示错误。
=> ERROR [base 2/2] WORKDIR /app ------
> [base 2/2] WORKDIR /app:
------
open /var/lib/docker/overlay2/702cb1f56ae4d4a7a5c14cf0db796842b47c7a237a02216dd59ac7bfd8044fca/merged/etc/passwd: no such file or directory
我尝试过的:
- 已删除 DockerC:\ProgramData 上的桌面文件夹
- 重新启动Docker
- 卸载并重新安装Docker
没有任何效果。任何人有使这项工作的想法吗?
下面是我的Docker文件
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1903 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1903 AS build
WORKDIR /src
COPY ["SampleCoreProject.csproj", "SampleCoreProject/"]
RUN dotnet restore "SampleCoreProject.csproj"
COPY . .
WORKDIR "/src/SampleCoreProject"
RUN dotnet build "SampleCoreProject.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "SampleCoreProject.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SampleCoreProject.dll"]
我创建了一个新项目,其中 .csproj
和 Dockerfile
在同一文件夹中,Dockerfile
与您的略有不同,试试这个:
FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["SampleCoreProject.csproj", "."]
RUN dotnet restore "./SampleCoreProject.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "SampleCoreProject.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "SampleCoreProject.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SampleCoreProject.dll"]
我正在尝试 'docker build -t aspnetapp .' 但它停止并在下面显示错误。
=> ERROR [base 2/2] WORKDIR /app ------
> [base 2/2] WORKDIR /app:
------
open /var/lib/docker/overlay2/702cb1f56ae4d4a7a5c14cf0db796842b47c7a237a02216dd59ac7bfd8044fca/merged/etc/passwd: no such file or directory
我尝试过的:
- 已删除 DockerC:\ProgramData 上的桌面文件夹
- 重新启动Docker
- 卸载并重新安装Docker
没有任何效果。任何人有使这项工作的想法吗?
下面是我的Docker文件
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-nanoserver-1903 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1903 AS build
WORKDIR /src
COPY ["SampleCoreProject.csproj", "SampleCoreProject/"]
RUN dotnet restore "SampleCoreProject.csproj"
COPY . .
WORKDIR "/src/SampleCoreProject"
RUN dotnet build "SampleCoreProject.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "SampleCoreProject.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SampleCoreProject.dll"]
我创建了一个新项目,其中 .csproj
和 Dockerfile
在同一文件夹中,Dockerfile
与您的略有不同,试试这个:
FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
WORKDIR /src
COPY ["SampleCoreProject.csproj", "."]
RUN dotnet restore "./SampleCoreProject.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "SampleCoreProject.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "SampleCoreProject.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "SampleCoreProject.dll"]