Home / Azure

AzureTroubleshootingIntermediate

App Service custom container 'didn't respond to HTTP pings': port, bind address, start time limit and image pull fixes

A Linux custom container on App Service fails to start with "didn't respond to HTTP pings on port". Find out whether it's the port, the bind address, startup time or the image, and fix it.

Deepak Bhardwaj7 min read

Applies toAzure App Service on Linux and Web App for Containers (custom images from ACR or Docker Hub); Azure CLI 2.x

Symptom

A Linux web app running a custom container shows Application Error or returns 503. The container log shows something like:

Container myapp_0_1a2b3c4d didn't respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
Container myapp_0_1a2b3c4d for site myapp has exited, failing site start

At startup, App Service runs your container and sends HTTP requests to the port it expects the app to listen on. If it gets no HTTP response within the start time limit (230 seconds by default), it stops the container and tries again. The message tells you the platform gave up waiting. It doesn't tell you why, so you have to find the cause.

Quick cause map

What the logs show Likely cause Fix
Ping port is 80, app logs "listening on 8080" (or 3000, 5000, 8000) Port mismatch Set WEBSITES_PORT to the app's port
App logs "listening on 127.0.0.1" or "localhost" Bind address Listen on 0.0.0.0
App starts slowly (migrations, JIT, model load) and logs stop before "ready" Start time limit hit Raise WEBSITES_CONTAINER_START_TIME_LIMIT, then fix startup time
Container exits within seconds, a stack trace or "exec format error" Crash on start or wrong CPU architecture Fix the entrypoint, or build linux/amd64
"Pull image failed", "unauthorized", "manifest unknown" Registry auth or wrong tag Fix ACR credentials or managed identity, check the tag
Works locally, fails only on App Service, writes to /home Storage mount hides image files Set WEBSITES_ENABLE_APP_SERVICE_STORAGE=false or change the path

Checks

1. Read the container and platform logs

Turn on container logging to the file system and stream the logs:

az webapp log config -g <rg> -n <app> --docker-container-logging filesystem
az webapp log tail -g <rg> -n <app>

To download the raw Docker log files, sign in to Kudu (https://<app>.scm.azurewebsites.net/api/logs/docker) in a browser, or run az webapp log download -g <rg> -n <app> --log-file logs.zip.

If you send App Service diagnostic settings to Log Analytics, the platform and app output are in two tables:

AppServicePlatformLogs
| where TimeGenerated > ago(2h)
| where _ResourceId has "/sites/<app>"
| where Message has_any ("HTTP pings", "failing site start", "Pull image", "exited")
| project TimeGenerated, Level, Message
| order by TimeGenerated desc

AppServiceConsoleLogs
| where TimeGenerated > ago(2h)
| where _ResourceId has "/sites/<app>"
| project TimeGenerated, ResultDescription
| order by TimeGenerated desc

The console log is your app's stdout/stderr. Find the last line it wrote before the platform gave up. That line usually points to the cause.

2. Compare the ping port with the app's port

Look at the port in the error message, then at what the app says it listens on. List the current settings:

az webapp config appsettings list -g <rg> -n <app> \
  --query "[?starts_with(name,'WEBSITES_') || name=='PORT'].{name:name,value:value}" -o table

If WEBSITES_PORT isn't set, App Service uses its default and may guess from the image's EXPOSE. Don't rely on the guess. Set it explicitly:

az webapp config appsettings set -g <rg> -n <app> --settings WEBSITES_PORT=8080

Changing app settings restarts the app.

3. Check the bind address

Many frameworks listen only on localhost by default. App Service pings the container from outside, so a loopback-only listener never answers. Typical fixes:

Stack Listen on all interfaces
Node.js / Express app.listen(process.env.PORT || 8080, '0.0.0.0')
Python Gunicorn gunicorn --bind 0.0.0.0:8000 app:app
Flask dev server flask run --host 0.0.0.0 (use Gunicorn in production)
ASP.NET Core ASPNETCORE_URLS=http://+:8080 (or ASPNETCORE_HTTP_PORTS=8080 on .NET 8+)
Spring Boot server.address=0.0.0.0, server.port=8080

Test the image locally the same way the platform calls it:

docker run --rm -p 8080:8080 -e WEBSITES_PORT=8080 <registry>/<image>:<tag>
curl -i http://localhost:8080/robots933456.txt

App Service's warm-up requests go to a path like /robots933456.txt. Any HTTP response counts, including a 404, so the app doesn't need to serve that path. It just needs to answer.

4. Check whether startup is too slow

If the console log shows steady progress (migrations, cache warm-up, model download) and then stops at the timeout, give the container more time while you fix the startup:

az webapp config appsettings set -g <rg> -n <app> \
  --settings WEBSITES_CONTAINER_START_TIME_LIMIT=600

The maximum is 1800 seconds. Check that the setting name is spelled exactly right. Misspelled variants are silently ignored.

Warning

A long start limit hides problems. During a scale-out or a platform restart, every new instance stays out of service for that long. Move slow work, such as database migrations, out of the container's start path and into a deployment step.

5. Check the image pull

If the logs show pull errors, the app never got as far as running your code.

az webapp config container show -g <rg> -n <app> -o table

For ACR with a managed identity instead of admin credentials:

PRINCIPAL=$(az webapp identity assign -g <rg> -n <app> --query principalId -o tsv)
ACR_ID=$(az acr show -n <registry> --query id -o tsv)
az role assignment create --assignee "$PRINCIPAL" --role AcrPull --scope "$ACR_ID"
az webapp config set -g <rg> -n <app> --generic-configurations '{"acrUseManagedIdentityCreds": true}'

Then confirm the tag exists and the image has a linux/amd64 manifest:

az acr repository show-tags -n <registry> --repository <image> --orderby time_desc --top 5 -o table
docker buildx imagetools inspect <registry>.azurecr.io/<image>:<tag>

Images built on Apple Silicon or other Arm machines without --platform linux/amd64 fail at start with exec format error.

If the registry is behind a private endpoint, the app needs VNet integration and the image pull has to go through the VNet (vnetImagePullEnabled on the site; check the current docs for the property name in your API version). The ACR private DNS zone must also resolve from the integration subnet.

6. Check the /home mount

If WEBSITES_ENABLE_APP_SERVICE_STORAGE is true, App Service mounts persistent storage at /home. Anything your image put under /home is hidden by the mount, so an app that runs from /home/site/app finds an empty folder and exits.

az webapp config appsettings set -g <rg> -n <app> --settings WEBSITES_ENABLE_APP_SERVICE_STORAGE=false

Or move the app files out of /home in the Dockerfile.

Fix and verify

  1. Apply the setting or image change. Then restart: az webapp restart -g <rg> -n <app>.
  2. Watch az webapp log tail until you see the platform log report that the container started and is ready for requests (wording varies by platform version).
  3. Request the site: curl -I https://<app>.azurewebsites.net.
  4. If you deploy through slots, apply the same WEBSITES_* settings on the slot before you swap.

Caution

Don't "fix" a bad production image by restarting in a loop. Each restart waits out the full start limit. Roll back to the last known good tag (az webapp config container set ... --container-image-name <registry>.azurecr.io/<image>:<good-tag>; older CLI builds use --docker-custom-image-name) or swap the slot back. Then debug the new image in staging.

Prevent it next time

  • Bake the port into the image (EXPOSE 8080, app reads PORT), and always set WEBSITES_PORT in IaC as well.
  • Run the container locally with the same curl ping in CI before pushing the tag.
  • Deploy immutable tags (:1.4.2 or a digest), not :latest, so a rollback is a one-line change.
  • Set App Service health check on a real readiness path so a container that starts but can't serve is taken out of rotation.
  • Send AppServicePlatformLogs and AppServiceConsoleLogs to Log Analytics, and alert on "failing site start".