App service from docker image is not accessible.

Kalyan Kamepalli 1 Reputation point
2022-03-21T08:34:13.413+00:00

Hi,

I am trying to convery my jupyter notebook as a simple web app using https://voila.readthedocs.io/en/stable/index.html. A docker image with all the required dependencies is created and the image works just fine when it's run on my desktop. Now an azure app service is created from the very same docker image and eposed the required ports in the docker container and also in app service configuration using both PORT and WEBSITES_PORT options and yet the app service returns "502 - Web server received an invalid response while acting as a gateway or proxy server."

Logs show a different port mapped to what is configured to run the docker image.

2022-03-21T08:07:32.735Z INFO - docker run -d -p 1658:8866 --name abc-test_0_8d420533 -e PORT=8866 -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITES_PORT=8866

8866 is the configured port but it's mapped to 1658. Am I missing something else ?

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Manu Philip 20,206 Reputation points MVP Volunteer Moderator
    2022-03-21T10:04:58.67+00:00

    Have a look at the ports open for inbound in App services here: networking-features

    This implies that, you can have port 80 or 443 only to be used in your deployments in web apps.
    For you specific need like opening the application in needed ports for inbound traffic, you may have a check at other similar offerings from Azure

    ----------

    --please don't forget to upvote and Accept as answer if the reply is helpful--


  2. Kalyan Kamepalli 1 Reputation point
    2022-03-22T10:17:45.08+00:00

    My container listens on a custom port so setting the following worked

    • WEBSITES_PORT to the same port that my container listens to. In my case it is 8866
    • setting host to 0.0.0.0 in the application configuration within the container. Without this, WEBSITES_PORT on app service settings doesn't work.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.