Hello,
I am trying to deploy a docker container using App Platform. In order for my container to work correctly I need to specify a custom CLI docker run command. For Example, docker run -e myEnvVar=MyVal --restart always
However I have been unable to get this to work successfully.
These docs here seem to indicate I may need to modify my “build commands” however I see no option to create / modify my build commands.
I resorted to modifying my app specs (see same link for information) however this also did not fix my issue.
Additional Specifications:
If I don’t specify any “build commands”, the container runs but crashes in the same way it does on my local machine when I don’t specify any docker run commands.
tl;dr: How to implement custom docker run ...
commands when deploying a docker container using App Platform.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hey!
You should not need the
--restart always
flag as the App Platform takes care of this for you, e.g. if the container stops the App Platform will know and make sure that it is running.For the
-e
this is also already handled for you, all that you need to do is to specify your environment variables in your app and the App Platform will handle the passing of those env variables in the run command:If you are using a Docker registry, there will be no build command as your images are going to be essentially already built and available on the registry.
The build command will be available when deploying using a Dockerfile or the native buildpacks, but if you already have an image available you don’t need it.
Let me know how it goes once you’ve defined your environment variables in the App Platform.
If it is still failing, feel free to share the exact error that you are seeing.