R
Railway10mo ago
SHxKM

How to override Dockerfile Start CMD/Entrypoint "in exec form"?

I guess this more about me not understanding what "exec form" exactly is (despite reading the docs). Can anyone give an example how would I override in a way that complies with how Railway works:
the start command overrides the Docker image's ENTRYPOINT in exec form
the start command overrides the Docker image's ENTRYPOINT in exec form
Let's say my default CMD is:
CMD ["gunicorn", "-c", "python:config.gunicorn", "config.wsgi"]
CMD ["gunicorn", "-c", "python:config.gunicorn", "config.wsgi"]
And the same Dockerfile has:
ENTRYPOINT ["/app/bin/docker-entrypoint-web"]
ENTRYPOINT ["/app/bin/docker-entrypoint-web"]
How do I change it to CMD:
CMD ["python", "manage.py", "someothercommand"]
CMD ["python", "manage.py", "someothercommand"]
29 Replies
Percy
Percy10mo ago
Project ID: 87f6d50b-7bab-488e-b802-02f9edc442e3
SHxKM
SHxKMOP10mo ago
87f6d50b-7bab-488e-b802-02f9edc442e3
Brody
Brody10mo ago
set the start command to
/app/bin/docker-entrypoint-web python manage.py someothercommand
/app/bin/docker-entrypoint-web python manage.py someothercommand
SHxKM
SHxKMOP10mo ago
Thanks @Brody ! Can I also pass env params like ${foo}? Or should it be just $foo in that case? Also, any reason this seems to be referring env vars from the local environment, rather than production? is there anything special about this override that makes it behave like this?
Brody
Brody10mo ago
you would need to wrap it in a shell, like so
/bin/sh -c "/app/bin/docker-entrypoint-web python manage.py someothercommand $SOME_VARIABLE"
/bin/sh -c "/app/bin/docker-entrypoint-web python manage.py someothercommand $SOME_VARIABLE"
probably you are pushing your local .env file
SHxKM
SHxKMOP10mo ago
Nope, that's not the case. But for some reason that command is looking at localhost:6379 instead of the production REDIS_URL. The other service, where I didn't override the Start Command, is functioning properly.
Brody
Brody10mo ago
do you have a REDIS_URL service variable?
SHxKM
SHxKMOP10mo ago
yes, in both of those services. It's a dynamic reference to the variable provided from Railway's platform
Brody
Brody10mo ago
are you using that variable in code?
SHxKM
SHxKMOP10mo ago
yes
Brody
Brody10mo ago
can you show me that code?
SHxKM
SHxKMOP10mo ago
No description
No description
Brody
Brody10mo ago
is that variable being used during build?
SHxKM
SHxKMOP10mo ago
care to explain what you mean by that?
Brody
Brody10mo ago
hmmm, not too sure how I could be clearer
SHxKM
SHxKMOP10mo ago
It is not mentioned anywhere in the Dockerfile if that's what you're asking
Brody
Brody10mo ago
well I'm trying to figure out if you need to, hence my question send the dockerfile?
SHxKM
SHxKMOP10mo ago
Let me check a hardcoded value of the remote path, and also print the ENV var I can't do that unfortunately
Brody
Brody10mo ago
you can't share the dockerfile?
SHxKM
SHxKMOP10mo ago
yeah I think it's a bug in this library I'm using..
Brody
Brody10mo ago
I'm curious, why aren't you able to share the dockerfile?
SHxKM
SHxKMOP10mo ago
Actually there is absoluately no reason why I can't share it. maybe I can just remove the labels
SHxKM
SHxKMOP10mo ago
By the way, I can't seem to do this: Is this not supported?
No description
Brody
Brody10mo ago
that's definitely supported, do the variables your referencing exist?
SHxKM
SHxKMOP10mo ago
Yeah apparently REDIS_PORT is empty inside Redis service, but there's REDIS_PRIVATE_URL which includes both I guess.
SHxKM
SHxKMOP10mo ago
No description
SHxKM
SHxKMOP10mo ago
I just misspelled it here, but it is indeed empty. And changing to REDIS_PRIVATE_URL does work.
Brody
Brody10mo ago
haha nothing is wrong with variable references, it was probably just done wrong is all
Want results from more Discord servers?
Add your server