Start command for docker image
Is there any way to provide launch command for the container? Command which I'm talking about looks like this:
`docker run -e TOKEN=$TOKEN -e KEY=$KEY app_name_here'
Error "Invalid command" is given when I'm trying to put it as a start command.
Whole case looks like this:
GitHub ----- GH Actions Building and Pushing Docker Image -----> Docker Hub ---- Pulling From DockerHub to Railway -----> Run Image with above command
Docker Image is not equipped with env variables due to public nature of this repo... that's why I'm doing it like that. Of course this image is working as planned on my local machine.. so is there any way to solve that? Or maybe any other way to handle it?
17 Replies
Project ID:
N/A
N/A
Of course direct deploy from repo is also working fine, but I wanted to get it done this way.
Railway has a system variables feature scoped to your container deploy @Afo
You go to your deploy > Variables > + New Variable
Add your vars as you wish, when you launch your docker it should populate the placeholders in your docker with the railway vars
What's the difference between service vars and shared variables? They are not behaving in same way?
Talking about this:
So are you saying that service variables are going to get injected into container?
Solution
Service variables are scoped to that isolated deploy
Yes
Thats correct
And shared variables, lets say you have 3 containers accessing 1 api
You can declare 1 shared variable and call the shared variable in all 3 containers while only declaring it once as a shared var
But for your application, system would be fine
Make sure you tell railway where the variables need to be populated however with the correct placeholder in your code
Okay, so just one more question because I'm not sure about that.. so basically let's say with Python I'll be able to call that vars in my code like
os.environ["VAR_NAME"]
is that correct? Or do I need to make some extra work?yes correct!
however i would resort to using the
attribute on your
so it would be
when you use the .get it will return None when you have the wrong name
if you call the normal dict it will raise an error
try this and tell me if it works
Ah yea sure, got it
Thank you, I'll try that
Appreciate your help π
from there u can error handle however u want when the value is None
yessir no problem
Oh yea.. now everything works fine with image from docker hub, once again thanks @Morpheus π
cool bro!
@Brody can you mark this as solved?
or maybe you can @Afo
Done