25

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.

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)

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)

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

Etienne Berube
  • 547
  • 1
  • 7
  • 21

5 Answers5

15

You can also try setting WEBSITES_CONTAINER_START_TIME_LIMIT to 1800

enter image description here

rpd
  • 323
  • 2
  • 9
7

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.

enter image description here

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

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..

kgalic
  • 2,441
  • 1
  • 9
  • 21
  • 2
    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 – Etienne Berube Nov 06 '19 at 08:22
  • 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? – kgalic Nov 06 '19 at 08:58
  • 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) – Etienne Berube Nov 06 '19 at 15:15
  • Can you please clarify what you have running on linux and what on windows? – kgalic Nov 06 '19 at 15:17
  • 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 – Etienne Berube Nov 06 '19 at 15:43
  • Check in the Kudu, within your web app in Azure portal which OS your App Service Plan runs on: https://blogs.msdn.microsoft.com/benjaminperkins/2017/12/07/how-to-check-if-azure-app-service-is-on-2016-what-version-of-iis/ – kgalic Nov 06 '19 at 15:55
6

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=8000

Pay attention if you have more slots (production/staging?), you have to set this env variable in the other slots too.

From: Azure App Service on Linux FAQ - Custom Contaniers

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.

freedev
  • 25,946
  • 8
  • 108
  • 125
5

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

EXPOSE 8000
CMD gunicorn -w 4 -b :8000 app:app

in the azure configuration application settings adding

"WEBSITES_PORT" : "8000" 

in the azure configuration general settings setting

"Always on" : "on"
-1

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

enter image description here

Karthikeyan VK
  • 5,310
  • 3
  • 37
  • 50