Reputation: 23
I built and deployed a docker image to ACR and App service. I exposed the port in the docker file and set WEBSITES_PORT
in the application settings. But I kept getting "didn't respond to HTTP pings" error.
In my Dockerfile:
EXPOSE 6000
WORKDIR /webapp/
ENTRYPOINT ["python", "server/main.py"]
Here are the logs where site startup failed:
2022-12-13T19:44:04.647Z INFO - Waiting for response to warmup request for container xxxx. Elapsed time = 1651.7761754 sec
2022-12-13T19:44:20.040Z INFO - Waiting for response to warmup request for container xxxx. Elapsed time = 1667.1697173 sec
2022-12-13T19:44:22.963Z ERROR - Container xxxx for site yyyy is not running, failing site start
2022-12-13T19:44:22.984Z ERROR - Container xxxx didn't respond to HTTP pings on port: 6000, failing site start. See container logs for debugging.
2022-12-13T19:44:23.002Z INFO - Stopping site yyyy because it failed during startup.
/home/LogFiles/2022_12_14_ln1mdlwk000058_default_docker.log (https://yyyy.scm.azurewebsites.net/api/vfs/LogFiles/2022_12_14_aaaa_default_docker.log)
2022-12-14T05:32:00.645431054Z [2022-12-14 05:32:00 +0000] [1] [INFO] Running on http://127.0.0.1:6000 (CTRL + C to quit)
2022-12-14T05:50:20.981722886Z [2022-12-14 05:50:20 +0000] [1] [INFO] Running on http://127.0.0.1:6000 (CTRL + C to quit)
Here are the logs where docker runs:
2022-12-14T06:33:02.853Z INFO - Pulling image: cccc.azurecr.io/bbbb:tag
2022-12-14T06:33:03.642Z INFO - 94 Pulling from bbbb
2022-12-14T06:33:03.643Z INFO - Digest: sha256:123456
2022-12-14T06:33:03.643Z INFO - Status: Image is up to date for cccc.azurecr.io/bbbb:tag
2022-12-14T06:33:03.646Z INFO - Pull Image successful, Time taken: 0 Minutes and 0 Seconds
2022-12-14T06:33:03.656Z INFO - Starting container for site
2022-12-14T06:33:03.657Z INFO - docker run -d --expose=6000
--name xxxx_0_d7bfb097
-e DOCKER_CUSTOM_IMAGE_NAME=cccc.azurecr.io/bbbb:tag
-e PORT=6000
-e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false
-e WEBSITES_PORT=6000
-e WEBSITE_SITE_NAME=xxxx
-e WEBSITE_AUTH_ENABLED=False
-e WEBSITE_ROLE_INSTANCE_ID=0
-e WEBSITE_HOSTNAME=xxxx.azurewebsites.net
-e WEBSITE_INSTANCE_ID=7210fbf7a062fd0ff739205809c9182b72493680f0a70d46e83abcbde795374a
-e HTTP_LOGGING_ENABLED=1
-e NODE_OPTIONS=--require /agents/node/build/src/Loader.js
-e JAVA_TOOL_OPTIONS=-javaagent:/agents/java/applicationinsights-agent-codeless.jar
-e StartupBootstrapper=Microsoft.ApplicationInsights.StartupBootstrapper
-e DOTNET_SHARED_STORE=/agents/core/store/lin
-e DOTNET_ADDITIONAL_DEPS=/agents/core/additionalDeps
-e WEBSITE_USE_DIAGNOSTIC_SERVER=False
cccc.azurecr.io/bbbb:tag
Btw I'm not sure where the variables like NODE_OPTIONS
, StartupBootstrapper
, and DOTNET_SHARED_STORE
come from...
I have gone through the solutions on these posts:
Docker never runs on Azure - Waiting for response to warmup request for container
[Bug] Azure App Service Container exposes and pings different ports This post does not -p
flag in docker run
and it still works.
Azure web app for container - failed during startup - didn't respond to HTTP pings.
My understanding: it looks like the app already runs in the docker, since it has Running on http://127.0.0.1:6000
. But the port it's not published to the host machine. The docker run
command only has --expose
flag, no -p
. That's why it keeps telling me Container xxxx didn't respond to HTTP pings on port
. I don’t know why it picked up the exposed port but not published it.
I have tried:
SSH CONN CLOSE
But none of them works.
Since I can’t edit docer run
command, what can I do to fix this?
Is my understanding of the current situation wrong?
Any help is appreciated. Thank you~
Upvotes: 1
Views: 1370
Reputation: 23
Figured it out! I should set the host to 0.0.0.0
, instead of using the default one 127.0.0.0
.
Another observation: after I deployed the image to app service, it will automatically add an environment variable PORT
with the value of EXPOSE
in Dockerfile. Without defining WEBSITES_PORT
, it somehow works with this command docker run --expose=6000 -PORT=6000
.
Upvotes: 1