Problem with running my app from container

Hi there
For my Blazor (.NET 5) app I created a container by

docker run -p 52115:5000 blazordockerapp

I can see it is running:

image

When I hit OPEN IN BROWSER using Docker Desktop, web page does not appear:

localhost This page isn’t working right now

What could be a reason?
Thanks.

It’s hard to tell from the formatting of localhost in your post, but apparently http://localhost:52115/ does not work for you, even though -p 52115:5000 publishes the internal port 5000 to port 52115 on your machine.

So, maybe the application is only accepting connections from what is considered localhost by the container? The following may help, though it’s not about .NET:

1 Like

Port 80 (not 5000) did the trick. So the “docker run -p 52115:80 blazordockerapp” works Ok. It is absolutely unclear since I use the Kestrel defaults (port 5000 and 5001 for https) in my Blazor app. Thoughts?

We cannot tell without seeing more details about that app. Like maybe the Dockerfile uses some base image to provide the web server part of your app (is that Kestrel?), and uses different settings than you think?

1 Like

Just for those who may be struggling with this issue like I was. My app was set to host itself on localhost:8080. As soon as I changed this to 0.0.0.0:8080, it worked

1 Like

yea it worked i was struggling to fix this