Cannot Access Asp.Net Core on Local Docker Container

I created an application in the asp.net core and am creating a docker file to create a local image and run it.

FROM microsoft/dotnet:latest

COPY . /app

WORKDIR /app

RUN ["dotnet", "restore"]

RUN ["dotnet", "build"]

EXPOSE 5000/tcp

ENTRYPOINT ["dotnet", "run", "--server.urls", "http://0.0.0.0:5000"]

Then I created my image with the following command

docker build -t jedidocker/first .

Then I created a container with the following command

docker run -t -d -p 5000:5000 jedidocker/first

But when I run the following URL in the host browser

http://localhost:5000/

I have ERR_EMPTY_RESPONSE

Is this a network problem? How can I solve it?

PS: My version for Windows is 10.0.10586

+4
source share
2 answers

. . localhost, - . program.cs, :

public class Program
{
    public static void Main(string[] args)
    {
        var host = new WebHostBuilder()
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseUrls("http://*:5000")
            .UseIISIntegration()
            .UseStartup<Startup>()
            .Build();

        host.Run();
    }
}

:

https://medium.com/trafi-tech-beat/running-net-core-on-docker-c438889eb5a#.hwhoak2c0

, -p .

docker run -p 5000:5000 <containerid>

, ,

EXPOSE 5000:5000

, -p. -P ( ).

8/28/2016:

. -d (), dotnet run . ( ), ERR_EMPTY_RESPONSE Chrome.

+6

, :

ENTRYPOINT ["dotnet", "run", "--server.urls", "http://*:5000"]

Docker Windows Server 2016 - NAT, IP-, docker inspect <container name/ID>. , Windows.

+4

Source: https://habr.com/ru/post/1651829/


All Articles