How do I use the $PORT environment variable in container based apps?


I am unsure where to use the $PORT environment variable in my Dockerfile for a container app


Container based apps using a Dockerfile have no build phase as part of the deploy process (the images are built locally before they are pushed to the registry). This means that dynamic information like the value of the $PORT environment variable must be read at runtime -the EXPOSE in the Dockerfile is not respected by the Heroku platform, but can be used for local testing.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support
Terms of Service Privacy Cookies © 2020