Docker Community Forums

Share and learn in the Docker community.

Accessing to docker without Visual studio 2019 running

Hi,

This is the first time that I use docker and for this reason I have sterted to use the default “hello word” project.

To do it I have created a new project in Visual Studio with docker support.

Before this, I have installed docker desktop that seem work fine.

This test application allow me to launch it by choosing 2 modes: Docker and webapplication1 (default is Docker).

When I launch this project in Docker mode the page work correctly and on Docker Desktop I see the container “WebApplication1” running on port 49162.

If the docker is running (like in my case) I except to see my application work fine without need Visual Studio.

If I stop the application I get this error:

This page isn’t working
localhost didn’t send any data.
ERR_EMPTY_RESPONSE

and here my docker file:

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY ["WebApplication1/WebApplication1.csproj", "WebApplication1/"]
RUN dotnet restore "WebApplication1/WebApplication1.csproj"
COPY . .
WORKDIR "/src/WebApplication1"
RUN dotnet build "WebApplication1.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "WebApplication1.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApplication1.dll"]

and here my log:

info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://[::]:80
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.

there is a way to solve ?