DEV Community

Discussion on: How to Dockerize a Node app and deploy to Heroku

Collapse
 
shameekagarwal profile image
shameekagarwal • Edited

to make sure that your container and your app are using the same port to communicate with each other.

actually, i wanted to run 3 containers on the same app -

  1. for backend
  2. for frontend
  3. for 'reverse proxy'

i ultimately went on to make 3 separate heroku apps, one for each container, which works absolutely fine.

what if i wanted to run all 3 containers on the same app?

  1. in my local development mode, all 3 containers run on their own port 3000.
  2. i tied my host port 3000 to the reverse proxy container's port 3000
  3. so now from my host, only reverse proxy is accessible, and i only needed one port to run 3 containers.

but in heroku, if i tie one container to the $PORT, what about the other 2 containers?
so i didnt want to run all the containers on the $PORT provided by heroku.