I have Docker desktop installed on my machine. I have configured dockerfile for C# ASP.NET Core Web API project created in Visual Studio 2022. It was working until I added file access code (appsettings.json
) through register services code.
I have full access to project and Docker as admin still I am getting error. Am I missing some setting? Below are some initial and final lines of the docker file and a screenshot of the error.
dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
.
.
.
.
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./webapi_project.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "webapi_project.dll"]
Error screenshot:
1