Running non-web app container on Azure Web Apps for Containers

Viewed 64

I'm trying to launch a constantly running container in Azure that reads from a queue and processes the messages with some application code. To do so, I want to use Azure Web App for Containers. Although I know this is not the most obvious choice since my container doesn't run a web app, I would like to know if this could be made to be workable.

I mocked the setup of a by a very simple Python script:

if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)
    count = 0
    while True:
        time.sleep(30)
        count += 30
        logging.info(f'Busy counting: {count}')

which I make callable in a Docker image with the following content:

FROM python:3.8-slim-buster
COPY main.py /app/main.py
WORKDIR /app
EXPOSE 80
    
CMD ["python", "./main.py"]

I set this image as the image to use in the Web App Service, after which the container is launched. I get the logging up until 230 seconds, after which the container is stopped with the following log message:

2022-06-16T14:46:34.582Z ERROR - Container testapp_123 for site testapp did not start within expected time limit. Elapsed time = 230.9588354 sec

and:

Container testapp_123 didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.

Now this obviously has to do with the fact that I have no web server listening on port 80. Is there any way to circumvent this pinging from even happening or running my app without a web server running, or would this be basically impossible to achieve?

0 Answers
Related