【Azure 应用服务】App Server 部署后,Docker报错,找不到8080端口

问题描述

App Service for Container.  Docker Image 推送到ACR(向 Azure 容器注册表), 配置App Service并部署成功了。查看Docker日志(Log Stream页面)详情如下:

复制代码
/home/LogFiles/2021_09_06_ll0sddwk000002_docker.log  (https://mytestappservice.scm.chinacloudsites.cn/api/vfs/LogFiles/2021_09_06_ll0sddwk000002_docker.log)
2021-09-06T03:28:44.786Z INFO  - Starting container for site
2021-09-06T03:28:44.787Z INFO  - docker run -d -p 8080:8080 --name mytestappservice_1_028b2421 -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=mytestappservice -e WEBSITE_AUTH_ENABLED=False -e PORT=8080 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=mytestappservice.chinacloudsites.cn -e WEBSITE_INSTANCE_ID=35a46b817ece1fe1cb77c89f27ac5f991e8f7d4f86abe5add36a6d6afb3f9989 myacrtest01.azurecr.cn/myacrr01/backendapi:latest  
2021-09-06T03:28:44.788Z INFO  - Logging is not enabled for this container.
Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here.
2021-09-06T03:28:49.314Z INFO  - Initiating warmup request to container mytestappservice_1_028b2421 for site mytestappservice
2021-09-06T03:29:20.005Z INFO  - Waiting for response to warmup request for container mytestappservice_1_028b2421. Elapsed time = 30.6914685 sec
2021-09-06T03:29:25.092Z ERROR - Container mytestappservice_1_028b2421 for site mytestappservice has exited, failing site start
2021-09-06T03:29:25.107Z ERROR - Container mytestappservice_1_028b2421 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
2021-09-06T03:29:25.127Z INFO  - Stopping site mytestappservice because it failed during startup.
复制代码

 

问题解决

对于自定义容器,App Service默认会尝试对端口 80 和 8080 进行自动端口检测, 而这里出现了HTTP ping 8080 failed,可以检测在Dockerfile中是否已经配置使用了8080端口。如果有,则从Dockerfile中修改,或者是通过App Service的Application Setting配置 WEBSITES_PORT参数,指定非8080的值,如WEBSITES_PORT = 8081。以解决问题。

 

 

更多有用有效的App Service for Container配置值,见:https://docs.microsoft.com/zh-cn/azure/app-service/reference-app-settings?tabs=kudu%2Cdotnet#custom-containers

 

 

参考资料

将应用服务配置为从注册表部署映像: https://docs.microsoft.com/zh-cn/azure/app-service/tutorial-custom-container?pivots=container-linux#configure-app-service-to-deploy-the-image-from-the-registry

自定义容器配置参数名:https://docs.microsoft.com/zh-cn/azure/app-service/reference-app-settings?tabs=kudu%2Cdotnet#custom-containers

 

posted @   路边两盏灯  阅读(602)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示