Error with a dotnet docker file

Hey folks so I’m getting this error when trying to build my project: open /var/lib/docker/overlay2/92d34ffbb49fafa1549cebcd87631eeb3f5d942768e80d24526eaa4c435726b1/merged/etc/passwd: no such file or directory I’m using the docker file Visual Studio provided me. Any ideas?
12 Replies
nebula
nebula2y ago
could you send the dockerfile?
Dillonzer
Dillonzer2y ago
yea sure one sec
Dillonzer
Dillonzer2y ago
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. #Depending on the operating system of the host machines(s) that will build or run the containers, the image specified in the FROM statement may need to be changed. #For more information, please see https://aka.ms/containercompat 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 ["PKMN_TCG_API/PKMN_TCG_API.csproj", "PKMN_TCG_API/"] RUN dotnet restore "PKMN_TCG_API/PKMN_TCG_API.csproj" COPY . . WORKDIR "/src/PKMN_TCG_API" RUN dotnet build "PKMN_TCG_API.csproj" -c Release -o /app/build FROM build AS publish RUN dotnet publish "PKMN_TCG_API.csproj" -c Release -o /app/publish FROM base AS final WORKDIR /app COPY --from=publish /app/publish . ENTRYPOINT ["dotnet", "PKMN_TCG_API.dll"]
How to customize Docker containers in Visual Studio - Visual Studio...
Information about the Visual Studio build process for containers, called fast mode, which is necessary to understand how to modify the Dockerfile to customize your container images for both debug and production builds.
Windows Container Version Compatibility
Version compatibility for containers built from different versions of Windows Server and Windows.
Dillonzer
Dillonzer2y ago
on mobile sorry for formatting
nebula
nebula2y ago
you could try removing the dockerfile and deploying it we automatically build for c#
Dillonzer
Dillonzer2y ago
I tried that but NIX doesn’t have the required libs for it apparently it built but crashed due to building for net 6
nebula
nebula2y ago
oh, what error did you get from the nixpacks build?
Dillonzer
Dillonzer2y ago
The framework 'Microsoft.AspNetCore.App', version '3.1.0' (x64) was not found only shows 6.0.6 It was not possible to find any compatible framework version The framework 'Microsoft.AspNetCore.App', version '3.1.0' (x64) was not found. - The following frameworks were found: 6.0.6 at [/nix/store/jk5x36xg2alwll963qzpgfahb5h43hww-user-environment/shared/Microsoft.AspNetCore.App] trying to transfer from heroku so still learning
nebula
nebula2y ago
oh i see you can add an environment variable called NIXPACKS_PKGS and set it to dotnet-sdk_3 that should work
Dillonzer
Dillonzer2y ago
okay cool I’ll give that a shot! Thanks! Alright finally have some time to test it out and now it throws this after removing the docker file and using NIXPACKS again:
#8 35.22 error: collision between `/nix/store/yqxqldacnsg2lagp6sp2p9szyj97iah1-dotnet-sdk-6.0.301/dotnet' and `/nix/store/2j0z3iw3v895983xl7vr56naxavdzkg7-dotnet-sdk-3.1.420/dotnet'

#8 35.22 error: collision between `/nix/store/yqxqldacnsg2lagp6sp2p9szyj97iah1-dotnet-sdk-6.0.301/dotnet' and `/nix/store/2j0z3iw3v895983xl7vr56naxavdzkg7-dotnet-sdk-3.1.420/dotnet'

Dillonzer
Dillonzer2y ago
oh, it won't work due to this bug: https://github.com/railwayapp/nixpacks/issues/323
GitHub
Configurable .NET Version · Issue #323 · railwayapp/nixpacks
Feature request Real senario: I need to deploy .NET 5, but by default Nixpacks builds with .NET 6. I can't change dotnet-sdk to dotnet-sdk_5 right now. There's NIXPACKS_PKGS but tha...
Dillonzer
Dillonzer2y ago
The issue with the docker file was I was building against windows instead of linux