PunchBird
PunchBird

Reputation: 109

Docker: 502/503 errors, waiting for response to warmup request for container

I have a web app in a Docker container that works perfectly if I run it locally, but when I deploy it to Azure it just won't work, whatever I try. I keep getting 502/503 errors. In the log file it says: Traceback (most recent call last): [ERROR] File "app.py", line 22, in [ERROR] app.run(use_reloader=use_reloader, debug=use_reloader, host=host, port=port) [ERROR] File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 922, in run [ERROR] run_simple(t.cast(str, host), port, self, **options) [ERROR] File "/usr/local/lib/python3.6/site-packages/werkzeug/serving.py", line 982, in run_simple [ERROR] s.bind(server_address) [ERROR] socket.gaierror: [Errno -2] Name or service not known

The configuration I have: Dockerfile: EXPOSE 80, application settings: see picture, app runs with this python code (this is just a snippet to show how environment variables are called):

if __name__ == '__main__':
    # Get environment variables
    use_reloader = os.environ.get('use_reloader')
    debug = os.environ.get('debug')
    port = os.environ.get('port')
    # Run the app
    app.run(use_reloader=use_reloader, debug=use_reloader, host=host, port=port)

What am I missing here? I looked at other answers related to this on here but that didn't help me with this. Anyone any suggestions? Thanks!

application settings

EDIT: I tried another attempt, now with in Dockerfile: EXPOSE 8000, and in application settings: port 80 (see code snippet app.py above) and WEBSITES_PORT 8000. But now I get: Waiting for response to warmup request for container. And then after many of these messages it times out and restarts... I think I still don't understand quite how it works with the port settings, would someone be able to explain this to me? So what I need to know: how don the environment variable 'port' in app.py, the EXPOSE in the Dockerfile and the settings 'port' and 'WEBSITES_PORT' in the application settings in the web app need to be aligned/configured? I just can't find clear information about this.

Upvotes: 0

Views: 3341

Answers (1)

PunchBird
PunchBird

Reputation: 109

I resolved the issue myself: the reason for the errors was that I had a huge image (with BERT model) but using a basic app plan. I upgraded to P1V3 and now it runs like a charm, with WEBSITES_PORT=8000 and WEBSITES_CONTAINER_START_LIMIT=1200. Please allow 2 minutes to warm up.

Upvotes: 0

Related Questions