linux 容器上的 .Net Core 应用程序 运行
.Net Core application running on a linux container
在 this link 之后,我构建了一个 .Net Core
应用程序,并且能够 运行 在 docker 容器中应用程序。我的主机 OS 是 Windows 10,我现在想在 Linux 容器中尝试 运行 链接的应用程序。我已经切换到 Linux 带有 Docker 桌面的容器。
当我构建 docker 图像时出现此错误:
failed to register layer: error creating overlay mount to /var/lib/docker/overlay2/f3e5279484774002c78a8eb66702c9ee7bca7038b59f4eeca7085b88dcbe25d9/merged: too many levels of symbolic links
我用过的Docker文件:
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-nanoserver-1903 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1903 AS build
WORKDIR /src
COPY ["NetCore.Docker/NetCore.Docker.csproj", "NetCore.Docker/"]
RUN dotnet restore "NetCore.Docker/NetCore.Docker.csproj"
COPY . .
WORKDIR "/src/NetCore.Docker"
RUN dotnet build "NetCore.Docker.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "NetCore.Docker.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "NetCore.Docker.dll"]
谢谢
原因是我使用了错误的图像,必须更改支持 linux 容器的图像
在 this link 之后,我构建了一个 .Net Core
应用程序,并且能够 运行 在 docker 容器中应用程序。我的主机 OS 是 Windows 10,我现在想在 Linux 容器中尝试 运行 链接的应用程序。我已经切换到 Linux 带有 Docker 桌面的容器。
当我构建 docker 图像时出现此错误:
failed to register layer: error creating overlay mount to /var/lib/docker/overlay2/f3e5279484774002c78a8eb66702c9ee7bca7038b59f4eeca7085b88dcbe25d9/merged: too many levels of symbolic links
我用过的Docker文件:
FROM mcr.microsoft.com/dotnet/core/runtime:3.1-nanoserver-1903 AS base
WORKDIR /app
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1903 AS build
WORKDIR /src
COPY ["NetCore.Docker/NetCore.Docker.csproj", "NetCore.Docker/"]
RUN dotnet restore "NetCore.Docker/NetCore.Docker.csproj"
COPY . .
WORKDIR "/src/NetCore.Docker"
RUN dotnet build "NetCore.Docker.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "NetCore.Docker.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "NetCore.Docker.dll"]
谢谢
原因是我使用了错误的图像,必须更改支持 linux 容器的图像