When running job in container, are CMD or ENTRYPOINT executed? #26943
-
When i run a job using “container: xxx/yyy:tag” will either CMD or ENTRYPOINT be executed? And will they have access to the “env:” defined for the job? E.g.
My scenario: I run my jobs in a container to ensure that the test environment is completely well defined. The container contains an ENTRYPOINT that sets up a package source when executed based on secrets retrieved from environment variables ( i do not want those secrets in the container itself as it is public ). It seems that ENTRYPOINT is not executed. I figure maybe CMD might work, but i would like to understand if i can even access the environment variables. Right now as a work around i have a startup.sh in my container that i execute in the job, but it adds one more line to every job. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @petertiedemann , According to the syntax of container, there’s no CMD or entrypoint settings, only in the ‘jobs.<job_id>.container.options’ , it’s possible to overwrite the default ENTRYPOINT of the image with “–entrypoint”. And during the initialization, container doesn’t have access to the “env” variables which defined in the job. The env variables can be accessed in the job steps. Thanks |
Beta Was this translation helpful? Give feedback.
-
Thank you, so sounds like i will have to stick with running my startup.sh manually. |
Beta Was this translation helpful? Give feedback.
Hi @petertiedemann ,
According to the syntax of container, there’s no CMD or entrypoint settings, only in the ‘jobs.<job_id>.container.options’ , it’s possible to overwrite the default ENTRYPOINT of the image with “–entrypoint”.
And during the initialization, container doesn’t have access to the “env” variables which defined in the job.
The env variables can be accessed in the job steps.
Thanks