2

Hi people have been looking at this for far too long and need some help.

I have made a ASP.NET core website nothing fancy just the template that goes with VS 2017 (v 1.1). I publish the site using dotnet core cli and build an image using this dockerfile:

FROM microsoft/dotnet:1.1-runtime
COPY /Publish /dotnetapp
WORKDIR /dotnetapp

EXPOSE 8444
ENTRYPOINT ["dotnet", "Inqu.dll"]

When i run the image created with:

docker run -it <image_name:tag> -p 8444:8444

The image starts up waiting for request:

Hosting environment: Production
Content root path: /dotnetapp
Now listening on: http://*:8444
Application started. Press Ctrl+C to shut down.

but i can't reach the site and getting an ERR_CONNECTION_REFUSED when trying to access the site thought http://local-ip:8444/

I have modified the WebHostBuild to:

        var host = new WebHostBuilder()
            .UseKestrel()
            .UseUrls("http://*:8444")
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseStartup<Startup>()
            .UseApplicationInsights()
            .Build();

        host.Run();

So it should listen to port 8444, I have also tried to set:

ENV ASPNETCORE_URLS http://*:8444

in the Dockerfile but it doesnt help.


I have some other images in docker up and running (gogs and mysql) and i can access them with my local ip:port with no problems, but i can't connect to the kestrel server.

Can somebody please help me out?

1 Answer 1

9

Was a stupid mistake arguments were in wrong order

docker run -it -p 8444:8444 <image_name:tag>

and it worked :\

Sign up to request clarification or add additional context in comments.

2 Comments

Trying to figure it out for two hours, thank you for saving me next two!
I learnt this the hard way too. According to run anything entered after the image name is related to cmd.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.