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

theoxiong7
HOBBY

a month 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

a month ago

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

a month 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

a month ago

nvm


Status changed to Solved chandrika about 2 months ago


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