none
Linux App Service VNet Integration Preview PORT setting RRS feed

Answers


  • However, if the port number is dynamic and not known until the application is deployed, how can this be set within the Dockerfile, it does not appear to be possible set this to an environment variable?


    Azure App Service for Linux injects the PORT / SSH_PORT environment variables into the docker container's environment when it is created.  So, scripts and processes executing inside your container should automatically have the PORT / SSH_PORT environment variables set to the dynamic port on which is should listen for HTTP / WebSSH traffic.

    This is demonstrated in the example provided on GitHub, which was referenced in the App Service Linux VNET Integration documentation.

    • Marked as answer by MarkBowler Friday, August 16, 2019 1:24 PM
    Thursday, August 15, 2019 4:18 PM

All replies


  • However, if the port number is dynamic and not known until the application is deployed, how can this be set within the Dockerfile, it does not appear to be possible set this to an environment variable?


    Azure App Service for Linux injects the PORT / SSH_PORT environment variables into the docker container's environment when it is created.  So, scripts and processes executing inside your container should automatically have the PORT / SSH_PORT environment variables set to the dynamic port on which is should listen for HTTP / WebSSH traffic.

    This is demonstrated in the example provided on GitHub, which was referenced in the App Service Linux VNET Integration documentation.

    • Marked as answer by MarkBowler Friday, August 16, 2019 1:24 PM
    Thursday, August 15, 2019 4:18 PM
  • Thanks.  PORT is passed through, however SSH_PORT isn't, as per below:

    2019-08-15 13:23:08.347 INFO  - docker run -d -p 17908:17908 --name dude-vnet-linux-uks-poc_0 -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=true -e WEBSITE_SITE_NAME=dude-vnet-linux-uks-poc -e WEBSITE_AUTH_ENABLED=False -e PORT=17908 -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=dude-vnet-linux-uks-poc.azurewebsites.net -e WEBSITE_INSTANCE_ID=74a00607285d883b7d8bba56c6442a95e1c75f2e7e55bc860a2aed31d56ba255 dudevnetpoc.azurecr.io/dude/vnetpoc:v3 

    I've configured Apache to listen on PORT, however it doesn't seem to be working.  Within my Dockerfile, I normally need to add `EXPOSE 80` as well.  I'll have another crack at it when I'm back in the office tomorrow.

    Thursday, August 15, 2019 6:07 PM
  • Got this bit to work.  My Apache configuration wasn't quite right, once I corrected this my container is now starting up and I can send HTTP traffic to it.

    Thanks for your response.

    Friday, August 16, 2019 1:24 PM