1

We are attempting to use Azure functions (HTTP trigger) to trigger a Java executable (JAR) in a Dockerfile. We are able to build, tag, and run the image locally with VSCode. However, when we push it to Azure, we receive a function runtime unreachable error.

The logs show:

'container didn't respond to http pings on port 4444 or 8080'

We tried the following:

  • Added WEBSITES_PORT for 4444 and 8080.
  • We also exposed those ports one at a time within the Dockerfile while pushing it.
  • We changed the value of WEBSITES_CONTAINER_START_TIME_LIMIT to 1800 and other values with no success.

The deployment center log show a message stating the docker image has been pulled successfully:

INFO - Pull Image successful, Time taken: 0 Minutes and 0 Seconds 
INFO - Starting container for site 
INFO - docker run -d -p 8080:8080 --name xxxx -e DOCKER_CUSTOM_IMAGE_NAME=notreal.azurecr.io/xxxx -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=8080 -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=abcdef abcdef.azurecr.io/xxxx 
INFO - Logging is not enabled for this container. Please use https://aka.ms/linux-diagnostics to enable logging to see container logs here. 
INFO - Initiating warmup request to container xxxx for site xxxx 
INFO - Waiting for response to warmup request for container xxxx. Elapsed time = 15.5217224 sec 
INFO - Waiting for response to warmup request for container xxxx. Elapsed time = 107.7627672 sec 
ERROR - Container xxxx for site xxxx is not running, failing site start 
ERROR - Container xxxx didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.

We've looked at numerous examples on Stack Overflow, but haven't been able to resolve this yet.

Daniel Campos Olivares
  • 2,262
  • 1
  • 10
  • 17
  • Is your SCM up and running ? Could you confirm if your connection to the storage account is configured correctly ? – glitch99 Jan 28 '22 at 20:43
  • Hi, yes, I have ensured that the scm is running (assuming you mean the site that is opened if you choose advanced tools on the left side blade and then click “go.”  I’ve also ensured the storage account is properly connected.  I even rotated the keys of the storage account just now and then updated the configuration settings in the function app to match the newly rotated keys.  Still receiving the same port/ping error as in my original post unfortunately. – matt_griswold Jan 31 '22 at 19:33

1 Answers1

0

Web/Function App for Containers allows you to expose only one port to the outside world. Your container only listens to HTTP requests on a single port. Some of your apps need multiple ports. For example, you might have one port that is used for requests into the app and a separate port that is used for a dashboard or admin portal.

You already configured the WEBSITES_PORT in the app setting with a port value.

In your custom image, you may use a port other than 80. So, you need to configure Azure to the port that your custom container can use by using the WEBSITES_PORT app setting.

If your App uses a different port - Use the EXPOSE instruction in your Dockerfile. It will expose the appropriate port Eg: (8080) and use the WEBSITES_PORT app setting as same port value 8080 on Azure to expose that port .

Add the EXPOSE instruction in the Dockerfile.

EXPOSE 8080

Refer here

Delliganesh Sevanesan
  • 4,146
  • 1
  • 5
  • 15
  • I’ve edited the Dockerfile to include an EXPOSE 8080 command, built the image, ran it locally, then pushed it to Azure. Once it’s been pushed, I create the function app and then add a WEBSITES_PORT setting for 8080. This didn’t work, so I edited the Dockerfile to change to EXPOSE 4444, followed the same process as before and then edited the configuration setting WEBSITES_PORT to 4444. I’ve tried other ports based on research I’ve done but what I’m getting at is that whatever port I expose in the Dockerfile, I then add a WEBSITES_PORT setting to match that port. – matt_griswold Jan 31 '22 at 19:49
  • I used to fix the issue using the above techniques. Please you can go through the flow and port once. – Delliganesh Sevanesan Feb 09 '22 at 07:13