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

QA testing team 55 Reputation points
2023-12-11T18:55:15.9633333+00:00

Hi,

I run flask code inside a docker container, the flask runs on port 5000, the dockerfile exposes that port, and Dockerfile:

FROM python:3.9-slim
WORKDIR /app
COPY . .
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 5000
CMD ["python", "app.py"]

I get error during startup in log stream: didn't respond to HTTP pings on port: 5000, failing site start. See container logs for debugging.

What am I doing wrong ?

Thanks,

Ilya

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

1 answer

Sort by: Most helpful
  1. VenkateshDodda-MSFT 25,111 Reputation points Microsoft Employee Moderator
    2023-12-12T01:24:29.18+00:00

    @QA testing team Thanks for reaching out to Microsoft Q&A, apologize for any inconvenience caused on this.

    As mentioned in this documentation, App Service has no control about which port your container listens on. What it does need is to know which port to forward requests to. If your container listens to port 80 or 8080, App Service is able to automatically detect it. If it listens to any other port, you need to set the WEBSITES_PORT app setting to the port number, and App Service forwards requests to that port in the container.

    Post adding the WEBSITES_PORT if you are still facing the issue. I would suggest you review the docker container logs by Enabling application logging or access the container logs via (https://<app-name>.scm.azurewebsites.net/api/logs/docker/zip endpoint) 1 to understand more what exactly causing the issues.

    0 comments No comments

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.