If a container starts up with CMD or ENTRYPOINT, will that CMD or ENTRYPOINT run in the background or another shell while the pipeline script is running?
More specifically:
I have a Dockerfile that ends like this:
CMD /cmd.sh
I want to use the container built from this Dockerfile as an environment to run my pipeline script in.
Will my CMD run in the background or another shell as my pipeline is running?
I don't want it to -- I just want to run the pipeline script.
But I need to know if I need to update the CMD script so that it won't run when the pipeline starts.
What I've Tried
I've looked for details in the official documentation on the subject and listed processes as a step in the pipeline.
Thanks.
Hello @joe ,
Welcome to Atlassian Community!
When a build is triggered in pipelines, it will start the build container to run your script commands. The docker run command that is executed under the hood in pipelines to start the container utilizes the --entrypoint flag to override any CMD or ENTRYPOINT you have defined in the image itself.
This means that pipelines will ignore any entry point/cmd you have defined in the image itself, and will always overwrite it with /bin/sh which is the shell session where the commands you have included in the script part of your YML file will be executed.
Hope that helps to clarify your questions :)
Thank you, @joe !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Patrik S is it documented anywhere? I went through docs multiple times in multiple days and didn't notice such thing
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @joe and @Dainius Tamošiūnas ,
This was indeed not yet documented in our public docs, so I went ahead and published an article in Bitbucket Cloud Knowledge Base sharing that information :
Thank you for reporting this!
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.