Web app (Python) doesn't connect after deploying code - "container ... didn't respond to HTTP pings on port: 8000 ..."

QA testing team 55 Reputation points
2023-11-04T13:32:36.35+00:00

Hi,

I have a web app with configuration
SCM_DO_BUILD_DURING_DEPLOYMENT = true
WEBSITES_PORT = 5000

I deployed a zip file using az cli and log stream says "did not start within expected time limit" and then "container ... didn't respond to HTTP pings on port: 8000, failing site start. See container logs for debugging."

I tried setting timeout to 1800 (max) also, same result.

My code is a very short Flask app that has only "/" endpoint and listens on port 5000, same as WEBSITES_PORT.

I tried all possible combinations of WEBSITES_PORT and the one that my app listens on.
Also I don't understand why the app is being pinged on port 8000
Also, what port should my app listen on and is it related to WEBSITES_PORT? is it related to the port that is exposed by the default container Azure runs for me ?

And above all - how can I make my app connect ?

Thanks in advance,

Ilya

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,277 questions
0 comments No comments
{count} votes

Accepted answer
  1. Konstantinos Passadis 19,381 Reputation points MVP
    2023-11-04T14:56:13.2+00:00

    Hello @QA testing team !

    Can you remove the WEBSITES_PORT please ?

    Kindly send your feedback

    Remove , restart and wait

    -

    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards


1 additional answer

Sort by: Most helpful
  1. Konstantinos Passadis 19,381 Reputation points MVP
    2023-11-04T14:22:55.6233333+00:00

    Hello @QA testing team !

    Welcome to Microsoft QnA!

    First of all , does your App works fine locally ? Test it first on local dev environment

    Then , the error message you're seeing, "container ... didn't respond to HTTP pings on port: 8000," suggests that Azure App Service expects your container to respond to HTTP pings on port 8000. By default, Azure App Service uses port 8000 to ping the container to check its health. This is separate from the port on which your application listens.

    Ensure that your Flask application is configured to respond to HTTP requests on port 5000 (as you mentioned), and you don't need to explicitly expose port 8000 in your Flask app.

    Also , make sure that your Docker container is properly built and configured to run your Flask application on port 5000 and Double-check your Dockerfile to ensure that it correctly exposes port 5000 and runs your Flask application.

    The timeout is most probable to occur due to the faulty container , aka your code

    Then come back with your feedback !


    I hope this helps!

    Kindly mark the answer as Accepted and Upvote in case it helped!

    Regards


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.