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
could you send the dockerfile?
yea sure one sec
#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.
on mobile sorry for formatting
you could try removing the dockerfile and deploying it
we automatically build for c#
I tried that but NIX doesn’t have the required libs for it apparently
it built but crashed due to building for net 6
oh, what error did you get from the nixpacks build?
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
oh i see
you can add an environment variable called
NIXPACKS_PKGS
and set it to dotnet-sdk_3
that should workokay 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:
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...
The issue with the docker file was I was building against windows instead of linux