R
Railway9mo ago
Dayblox

Listening on $PORT with docker image

I'm trying to run https://hub.docker.com/r/sundowndev/phoneinfoga but am not able to listen on the railway PORT. While debugging, using echo $PORT as the start command just prints $PORT, which seems to indicate that $PORT is not defined?
Solution:
There's no variable expansion in exec mode
Jump to solution
8 Replies
Percy
Percy9mo ago
Project ID: b3abd4e5-22bc-4778-8218-bceb341997df
Solution
Fragly
Fragly9mo ago
There's no variable expansion in exec mode
Dayblox
Dayblox9mo ago
Found a workaround by calling it in sh -c
Fragly
Fragly9mo ago
yea, wrapping it in shell is a nice workaround
Dayblox
Dayblox9mo ago
On a "normal" github service, variable expansion works fine tho
Fragly
Fragly9mo ago
you can also set a static port by specifying the static port you set in your service variables if you choose to use port 5000 like in the docker image then you just set thePORT service variable to 5000 but executing it in shell is completely fine too
Dayblox
Dayblox9mo ago
How come on a docker service, echo $PORT as a start command doesn't print the PORT but does on a custom github service?
Fragly
Fragly9mo ago
When you build a docker service and set a custom start command, it sets that start command in the docker image's ENTRYPOINT in exec form, which is why variable expansion does not work When you deploy a github service that doesn't have a Dockerfile, you'll be using Nixpacks I think nixpacks just runs the start command in some kind of launch process where it's likely run in shell
Want results from more Discord servers?
Add your server