C
C#2w ago
tri

what URL should Kestrel listen to in a docker container on Azure App Service

I have an ASP.NET Core in a docker container that will be hosted on Azure App Service. What URL should I have Kestrel, which is inside the container, listen on when deploying to Azure App Service? My mental model is I could use localhost:8080, then bind that container port 8080 to port 443 of Azure App Service via -p 443:8080. So when visiting https://myapp.azurewebsites.net, that 443 will be forwarded to 8080 that Kestrel is listening to. ChatGPT suggested to listen to wildcard 0.0.0.0, but my gut feeling of both localhost and 0.0.0.0 are wrong So what is the correct way to do? Thank you. I am self-taught and I only have very basic networking knowledge so please explain like I'm 5, and give keywords so that I could research more. Thank you
1 Reply
p.armytank
p.armytank2w ago
You need to give the app service an application setting for WEBSITES_PORT with the value of whatever port your container is listening on (8080 probably). You will also need to expose 8080 from the container. https://stackoverflow.com/questions/48693878/how-do-you-expose-port-3000-using-an-azure-web-app-container
Stack Overflow
How do you expose port 3000 using an Azure Web App Container?
I'm running a react boilerplate app within a docker container, hosted Azure Web App Containers. Locally, I spin the app up with: docker run -p 3000:3000 431e522f8a87 My docker file looks like this...