Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Do Docker start-up scripts run in a containerized pipeline?

joe
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 3, 2023

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.

1 answer

1 accepted

0 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 6, 2023

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

joe
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 11, 2023

Thanks @Patrik S . Can you post a link in the official documentation that indicates this?

Dainius Tamošiūnas
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 30, 2023

@Patrik S is it documented anywhere? I went through docs multiple times in multiple days and didn't notice such thing

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 28, 2023

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

Like # people like this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events