I'm trying to deploy a dockerized app on Azure's App Service. I enter all the fields correctly, my image gets pulled, put I keep getting this error until something times out.
我正在尝试在Azure的应用服务上部署停靠的应用。我正确地输入了所有字段,我的图像被拉出,我一直收到这个错误,直到有东西超时。
Waiting for response to warmup request for container -<container name > Elapsed time = 154.673506 sec
I did set WEBSITE_PORT 8080 (used by my app)
我确实设置了WebSite_Port 8080(由我的应用程序使用)
Here is the dockerfile
这是文档文件
FROM google/dart
WORKDIR /app
ADD pubspec.* /app/
RUN pub get --no-precompile
ADD . /app/
RUN pub get --offline --no-precompile
WORKDIR /app
EXPOSE 8080
ENTRYPOINT ["pub", "run", "aqueduct:aqueduct", "serve", "--port", "8080"]
It was working fine. I had it working last night. I wanted to refresh my image so I restarted. Nothing worked. After multiple hours I deleted my app and started again... no luck. Any ideas?
它运行得很好。我昨晚把它修好了。我想刷新我的形象,所以我重新开始了。什么都不管用。几个小时后,我删除了我的应用程序,并重新启动...运气不好。有什么主意吗?
EDIT 1:
Tried changing port to 80, no luck (This was the port I was using at first when it was working fine)
编辑1:尝试将端口更改为80,但没有成功(这是我最初使用的端口,当时它运行良好)
RESOLVED (Partially)*
I changed everything to port 8000. I realized that Linux and windows did not like having something non-system listening on 80. Therefore I changed everything on 8000 and set the system properties on Azure {WEBSITE_PORT, 8000}. IT now seems to work fine. I don't know if this is an official fix... But it does warmup after 30-ish seconds
已解决(部分)*我将所有内容都更改为端口8000。我意识到Linux和Windows不喜欢让非系统监听80。因此,我更改了8000上的所有内容,并在Azure{WebSite_Port,8000}上设置了系统属性。现在,它似乎运行得很好。我不知道这是不是官方的解决办法。但它确实会在30秒后预热
更多回答
Only the one error log? The problem is not on the port.
只有一个错误日志?问题不在端口上。
Yeah, It runs fine locally, which is weird considering it was working fine before. Would you have any ideas what I could investigate?
是的,它在本地运行良好,这是奇怪的,考虑到它以前运行良好。你知道我能调查什么吗?
is the setting WEBSITE_PORT or WEBSITES_PORT ?
设置是WebSite_Port还是WebSites_Port?
setting the PORT variable to the deployed one solved for me
将端口变量设置为为我解决的已部署变量
use WEBSITES_PORT instead of WEBSITE_PORT
使用WebSites_Port代替WebSite_Port
You can also try setting WEBSITES_CONTAINER_START_TIME_LIMIT
to 1800
也可以尝试将WebSites_Container_Start_Time_Limit设置为1800
Depending which App Service plan you have, if there is an option ‘always on’, try to set ‘always on’ in the configuration of your app in Azure portal.
根据你拥有的应用服务计划,如果有选项“Always On”,请尝试在Azure门户中的应用配置中设置“Always On”。
If you are using a Premium App service plan, you can set pre-warm number of instances. Try to set that to 2-3 and see if it gets any better..here
如果您使用的是高级应用服务计划,您可以设置预热实例数。试着将其设置为2-3,看看是否会变得更好。
I had the same experience as you, but my container was really big since it contained ML model, so at the end I switched to AKS because it performed better..
我和你有同样的经历,但我的容器真的很大,因为它包含ML模型,所以最后我切换到AKS,因为它的性能更好。
App Service - Docker container deploy
In my case, this slowdown was caused by automatic port detection.
Setting the WEBSITES_PORT
in the application setting solved the problem.
在我的例子中,这种减速是由自动端口检测引起的。在应用程序设置中设置WebSites_Port解决了问题。
WEBSITES_PORT=8000
Pay attention if you have more slots (production/staging?), you have to set this env variable in the other slots too.
如果您有更多插槽(生产/分段?),请注意,你必须在其他插槽中设置这个env变量。
From: Azure App Service on Linux FAQ - Custom Contaniers
来自:Azure App Service on Linux FAQ-Custom Contanier
We have automatic port detection. You can also specify an app setting called WEBSITES_PORT and give it the value of the expected port number. Previously, the platform used the PORT app setting. We are planning to deprecate this app setting and to use WEBSITES_PORT exclusively.
what actually worked for me was a combination of the answers above by Ethiene and kgalic, setting all ports to 8000 in the docker file
对我来说,实际有效的是Ethiene和kgalic上面的答案的组合,在docker文件中将所有端口设置为8000
EXPOSE 8000
CMD gunicorn -w 4 -b :8000 app:app
in the azure configuration application settings adding
在Azure配置应用程序设置中添加
"WEBSITES_PORT" : "8000"
in the azure configuration general settings setting
在Azure配置常规设置设置中
"Always on" : "on"
In my case, I have changes the “start” command section in package.json (to a different port than the default one) for local testing purposes, and accidentally pushed these changes.
在我的例子中,出于本地测试的目的,我更改了Package.json中的“Start”命令部分(更改为与默认端口不同的端口),并意外地推送了这些更改。
I had this same problem when I used the nodejs application, so I did build the dist folder by npm build
on the creation of the docker image, so it is part of the docker image rather than the docker cmd creating the build image on the initial execution of the app. Maybe the RAM and CPU wasn't enough for the npm build to happen at the initial runtime
当我使用NodeJS应用程序时,我遇到了同样的问题,所以我在创建docker映像时通过NPM Build构建dist文件夹,因此它是docker映像的一部分,而不是在应用程序的初始执行时创建构建映像的docker cmd。也许RAM和CPU不足以在初始运行时进行NPM构建
更多回答
I'm on the student plan. Which means I do not have access to such features. I'm at a lost because even though all the ports are set correctly, I cannot seem to make it work. My docker exposes port 80. My app listens on port 80... Why don't they speak to each other... I doesn't even run... it just stays there and tells me it cant warmup the container
我在学生计划里。这意味着我无法访问这些功能。我手足无措,因为即使所有端口都设置正确,我似乎也无法使其工作。我的码头暴露出80号端口。我的应用程序在端口80上侦听...为什么他们不互相谈谈..。我甚至都不跑..。它就呆在那里,告诉我它不能预热集装箱
Port 8080.. Have you tried to run your container locally and make sure it does not crash after it starts? Do you have any logging in place?
端口8080..您是否尝试过在本地运行容器,并确保它在启动后不会崩溃?你们有没有在适当的地方伐木?
It runs fine locally as well... Works perfectly. I'm starting to wonder if it would be an OS issue (one of my computers is linux and the other is windows)
它在当地也运行得很好。效果非常好。我开始怀疑这是否会是操作系统的问题(我的一台电脑是Linux,另一台是Windows)
Can you please clarify what you have running on linux and what on windows?
您能澄清一下您在Linux上运行的是什么,在Windows上运行的是什么吗?
So it's a really small school project. Its a simple REST API. Nothing too hard by itself. Considering I have one windows computer and one linux, I dockerize pretty much all of my homework. However, I get warnings when running my linux dockers on windows (something about a different filesystem). I'm not sure if it really plays a role in this, but I'm at a lost right now and will investigate anything I can
所以这是一个非常小的学校项目。这是一个简单的REST API。不是太难的事。考虑到我有一台Windows电脑和一台Linux操作系统,我几乎完成了所有的作业。然而,当我在Windows上运行我的Linux Dockers(关于不同的文件系统)时,我收到警告。我不确定它是否真的在这件事上起了作用,但我现在迷路了,我会尽我所能调查
我是一名优秀的程序员,十分优秀!