Hey Guys
I have problem with Visual Studio and Docker.
When I run my project in Visual Studio (with selected “Docker”) the images are properly created and the container is created. I can access the program via localhost:[port] (in web browser).
But when I stop my program in Visual Studio, access via localhost:[port] it doesn’t work (container with my program still run).
What I need to do to fix it (for the program to work in Docker despite the Visual Studio closed)? My dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["WebApp/WebApp.csproj", "WebApp/"]
RUN dotnet restore "WebApp/WebApp.csproj"
COPY . .
WORKDIR "/src/WebApp"
RUN dotnet build "WebApp.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "WebApp.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApp.dll"]
Thanks a lot.