Error: '$PORT' is not a valid port number.

theoxiong7
HOBBY

4 months ago

The following start command in my Dockerfile is causing the error in tittle:

CMD exec gunicorn --bind 0.0.0.0:$PORT --timeout 600 app:app

I've looked at other threads with similar problems and tried applying the fixes posted there, to no avail.

I also believe this is the reason why my deployment is failing the health check. Please advise!

Solved$10 Bounty

3 Replies

Hey, can you change your command to 'sh -c "gunicorn --bind 0.0.0.0:$PORT --timeout 600 app:app"'? As you're not spawning an actual shell the environment variables won't work


passos

Hey, can you change your command to 'sh -c "gunicorn --bind 0.0.0.0:$PORT --timeout 600 app:app"'? As you're not spawning an actual shell the environment variables won't work

theoxiong7
HOBBY

4 months ago

thank you!


passos

Hey, can you change your command to 'sh -c "gunicorn --bind 0.0.0.0:$PORT --timeout 600 app:app"'? As you're not spawning an actual shell the environment variables won't work

theoxiong7
HOBBY

4 months ago

nvm


Status changed to Solved chandrika 4 months ago


Error: '$PORT' is not a valid port number. - Railway Help Station