How do I pass an argument to a service container in a bitbucket pipeline?
Asked by mac_nsr:

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](https://support.atlassian.com/bitbucket-cloud/docs/databases-and-service-containers/#TestwithdatabasesinBitbucketPipelines-image-with-db) 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"
```


Answers:
author: Mark C
body: Hi [@mac_nsr](/t5/user/viewprofilepage/user-id/4849260)

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](https://support.atlassian.com/bitbucket-cloud/docs/run-docker-commands-in-bitbucket-pipelines/#Full-list-of-restricted-commands) 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](https://hub.docker.com/) 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

comments: author: mac_nsr
body: Thanks [@Mark C](/t5/user/viewprofilepage/user-id/1210823), 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.


author: Mark C
body: Hi [@mac_nsr](/t5/user/viewprofilepage/user-id/4849260),  

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.

![](https://getsupport.atlassian.com/images/icons/emoticons/information.png) 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](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html).  

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

Regards,  
Mark C

comments: author: mac_nsr
body: Thank you, I appreciate you adding the feature request.


Tags: bitbucket-cloud

cloud