Home > OS >  azure app service, container without exposed port shutdown after a while
azure app service, container without exposed port shutdown after a while

Time:04-12

I created a Celery image that connects to my Azure Redis cache. I deployed it on Azure App service container. It works, however the container is shut down after a period of time because Azure cannot ping the port 80. Because it's a Celery server which only communicates with my Redis broker, therefore I do not open any port. How can I handle this ? Please note that the option "Always On" is activated.

The error message is:

2022-04-11T13:18:40.687Z INFO - Waiting for response to warmup request for container lucius-jobs-demo_0_195f1394. Elapsed time = 82.9096881 sec
2022-04-11T13:19:12.920Z INFO - Waiting for response to warmup request for container lucius-jobs-demo_0_195f1394. Elapsed time = 115.1424324 sec
2022-04-11T13:19:28.044Z INFO - Waiting for response to warmup request for container lucius-jobs-demo_0_195f1394. Elapsed time = 130.2660597 sec
2022-04-11T13:19:43.143Z INFO - Waiting for response to warmup request for container lucius-jobs-demo_0_195f1394. Elapsed time = 145.3659352 sec
2022-04-11T13:20:14.089Z INFO - Waiting for response to warmup request for container lucius-jobs-demo_0_195f1394. Elapsed time = 176.3117059 sec
2022-04-11T13:20:29.328Z INFO - Waiting for response to warmup request for container lucius-jobs-demo_0_195f1394. Elapsed time = 191.5505154 sec
2022-04-11T13:21:03.104Z INFO - Waiting for response to warmup request for container lucius-jobs-demo_0_195f1394. Elapsed time = 225.3264671 sec
2022-04-11T13:21:08.172Z ERROR - Container lucius-jobs-demo_0_195f1394 for site lucius-jobs-demo did not start within expected time limit. Elapsed time = 230.3948725 sec
2022-04-11T13:21:08.176Z ERROR - Container lucius-jobs-demo_0_195f1394 didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
2022-04-11T13:21:08.183Z INFO - Stopping site lucius-jobs-demo because it failed during startup.

CodePudding user response:

I did open the port and create a function to answer the ping but obviously it's not the right solution

CodePudding user response:

The automatic port detection detects the port (port 80 is the default), but you can also use the WEBSITES_PORT app setting and configure it with a value for the port you want to bind to your container.

However, the web server in your custom image may use a port other than 80. You tell Azure about the port that your custom container uses by using the WEBSITES_PORT app setting.

In this case, yes you will have to change the App Setting configuration from the Portal.

For a different port - Use the EXPOSE instruction in your Dockerfile to expose the appropriate port (E.g 3000) and use the WEBSITES_PORT app setting on Azure with a value of "3000" to expose that port.

  • Related