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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,506,708
Community Members
 
Community Events
180
Community Groups

How do I pass an argument to a service container in a bitbucket pipeline?

I am trying to set up a bitbucket pipeline that uses a database service provided by a container. However, in order to get the database service started correctly, I need to pass an argument to be received by the database container's ENTRYPOINT. I see from the pipeline service doc that it's possible to send `variables` to the service's docker container, but the option I need to set isn't settable by an environment variable, only by a command line argument.

When I run the database's docker image locally using `docker run`, I am able to set the option just by adding it to the end of the `docker run` command, and it gets correctly applied to the container's ENTRYPOINT, so it seems like it should be straightforward, I just can't figure out where to put the argument in bitbucket-pipelines.yml.

So, for example, here's a sample `definitions` section showing what I'm looking for:

definitions:
services:
myFavoriteDatabase:
image: myFavoriteDatabase
something-here-to-pass-an-argument-to-myFavoriteDatabase-please: "-myOption 10"

2 answers

1 accepted

0 votes
Answer accepted
Mark C Atlassian Team Mar 31, 2022

Hi @mac_nsr

Welcome to the community.

Unfortunately, it's not possible to pass extra arguments or commands while running a service container on Pipelines.

As a workaround, you have 2 options for this:

  1. You can start the service container by running a Docker command within Pipelines as long as the command is not restricted.
    • You can check this link for more information about Docker restricted commands on Pipelines.
  2. You can create your own Docker image (using Dockerfile) and upload it to Docker Hub then use that image as a service container on Pipelines

Hope it helps and let me know if you have further questions that I can help with.

Regards,
Mark C

Thanks @Mark C, I imagine I can make one of those workarounds work. In the meantime, is there a way to turn this into a feature request? I imagine I'm not the only one who would find it convenient to be able to pass arguments to a service container, and it seems pretty similar to the `variables` feature that's already available.

0 votes
Mark C Atlassian Team Apr 04, 2022

Hi @mac_nsr,

I went ahead and created a feature request for you that can be located through this link. - https://jira.atlassian.com/browse/BCLOUD-21810
You can upvote and watch it for now so that you'll be notified of any updates from our team when the feature becomes available on Bitbucket Cloud.

Please do note that we don't have an exact ETA for the feature request as all new features will be implemented according to our policy here.

Hope it helps and let me know if you have further questions.

Regards,
Mark C

Thank you, I appreciate you adding the feature request.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events