Passing CLI args to start command

I'm currently trying to create a template, and I want to pass env vars as arguments to the start command. Is there a way to do this? From my initial research, it seems not since custom start commands are run using exec mode, but I might be overlooking something.
Solution:
you are correct, they are running in exec mode when using an image or Dockerfile, the solution is to wrap the command in a shell that contains exec again -
/bin/sh -c "exec server -h 0.0.0.0 -p $PORT"
/bin/sh -c "exec server -h 0.0.0.0 -p $PORT"
this string will be interpolated and then exec will replace the original shell and run the command with the now interpolated variables...
Jump to solution
5 Replies
Percy
Percy4mo ago
Project ID: 75e3b346-93c5-4759-b0c7-991c535ad323
battlesqui_d
battlesqui_d4mo ago
75e3b346-93c5-4759-b0c7-991c535ad323
Solution
Brody
Brody4mo ago
you are correct, they are running in exec mode when using an image or Dockerfile, the solution is to wrap the command in a shell that contains exec again -
/bin/sh -c "exec server -h 0.0.0.0 -p $PORT"
/bin/sh -c "exec server -h 0.0.0.0 -p $PORT"
this string will be interpolated and then exec will replace the original shell and run the command with the now interpolated variables
battlesqui_d
battlesqui_d3mo ago
Sorry for the late response, this worked, thank you Only issue is that now I'm into the networking issues I described in the other post Edge works, chrome doesn't, i get "Application failed to respond" At a loss for what the issue could be
Brody
Brody3mo ago
lets go back to that thread?
Want results from more Discord servers?
Add your server