在容器的Azure Web应用程序上运行非WEB应用程序容器
我正在尝试在Azure中启动一个不断运行的容器,该容器从队列中读取并使用某些应用程序代码处理消息。为此,我想将 Azure Web应用程序用于容器。尽管我知道这不是最明显的选择,因为我的容器没有运行Web应用程序,但我想知道是否可以使其可行。
我通过一个非常简单的python脚本模拟了A的设置:
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
count = 0
while True:
time.sleep(30)
count += 30
logging.info(f'Busy counting: {count}')
我可以在带有以下内容的Docker映像中制作可召唤:
FROM python:3.8-slim-buster
COPY main.py /app/main.py
WORKDIR /app
EXPOSE 80
CMD ["python", "./main.py"]
我将此映像设置为要在Web App服务中使用的映像,之后启动了容器。我将日志记录到230秒之前,然后将容器停止以下日志
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
::
Container testapp_123 didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
消息 在没有Web服务器运行的情况下,从发生或运行我的应用程序中的ping,还是基本上不可能实现?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论