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

简介: 【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

 

相关文章
|
22天前
|
开发工具 git C++
【App Service】VS Code直接部署App Service时候遇见 “fatal: not a git repository (or any of the parent directories): .git”
通过VS Code发布Python App Service的时候,遇见了发布失败错误: The deployment failed with error: fatal: not a git repository (or any of the parent directories): .git . Please take a few minutes to help us improve the deployment experience
72 24
|
1月前
|
Docker 容器
docker中端口映射
【10月更文挑战第7天】
105 65
|
7天前
|
JavaScript C++ 容器
【Azure Bot Service】部署NodeJS ChatBot代码到App Service中无法自动启动
2024-11-12T12:22:40.366223350Z Error: Cannot find module 'dotenv' 2024-11-12T12:40:12.538120729Z Error: Cannot find module 'restify' 2024-11-12T12:48:13.348529900Z Error: Cannot find module 'lodash'
30 11
|
5天前
|
开发框架 监控 .NET
【Azure App Service】部署在App Service上的.NET应用内存消耗不能超过2GB的情况分析
x64 dotnet runtime is not installed on the app service by default. Since we had the app service running in x64, it was proxying the request to a 32 bit dotnet process which was throwing an OutOfMemoryException with requests >100MB. It worked on the IaaS servers because we had the x64 runtime install
|
14天前
|
C#
【Azure App Service】使用Microsoft.Office.Interop.Word来操作Word文档,部署到App Service后报错COMException
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)).
|
21天前
|
机器人 Shell Linux
【Azure Bot Service】部署Python ChatBot代码到App Service中
本文介绍了使用Python编写的ChatBot在部署到Azure App Service时遇到的问题及解决方案。主要问题是应用启动失败,错误信息为“Failed to find attribute 'app' in 'app'”。解决步骤包括:1) 修改`app.py`文件,添加`init_func`函数;2) 配置`config.py`,添加与Azure Bot Service认证相关的配置项;3) 设置App Service的启动命令为`python3 -m aiohttp.web -H 0.0.0.0 -P 8000 app:init_func`。
|
1月前
|
Docker 容器
一个docker容器暴露多个端口
一个docker容器暴露多个端口
24 3
|
3月前
|
Java 应用服务中间件 nginx
【Azure Spring Apps】Spring App部署上云遇见 502 Bad Gateway nginx
【Azure Spring Apps】Spring App部署上云遇见 502 Bad Gateway nginx
|
4月前
|
弹性计算 应用服务中间件 Linux
阿里云服务器开放端口完整图文教程
笔者近期开发完成的服务端程序部署在阿里云的ECS云服务器上面,一些应用程序配置文件需要设置监听的端口(如Tomcat的8080、443端口等),虽然通过CentOs 7系统的的「防火墙」开放了对应的端口号,任然无法访问端口号对应的应用程序,后面了解到原来还需要设置云服务器的「安全组规则」,开放相应的端口权限,服务端的接口才能真正开放。
678 1
阿里云服务器开放端口完整图文教程
|
4月前
|
弹性计算 运维 数据安全/隐私保护
云服务器 ECS产品使用问题之如何更改服务器的IP地址或端口号
云服务器ECS(Elastic Compute Service)是各大云服务商阿里云提供的一种基础云计算服务,它允许用户租用云端计算资源来部署和运行各种应用程序。以下是一个关于如何使用ECS产品的综合指南。