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

How to include files on service containers

Ben Zuill-Smith December 12, 2022

I have a seed script that I want to run on a mongo service container for use in my repo's Pipelines. The mongo image can automatically run scripts if provided in a special folder. Is there a way to provide this from my repo code or do I need to create and publish a docker image that includes the seed script(s)?

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 13, 2022

Hi Ben,

Yes, you are able to provide the scripts in the repository source, as when you perform a build - it will clone the Bitbucket repository as your working directory. This then allows you to navigate to this folder and execute scripts.

You could also create a docker image, however, you would need to push changes to the docker image whenever changes to the scripts are made vs simply committing these changes into the repository.

Cheers!

- Ben (Bitbucket Cloud Support)

dev December 15, 2022

Hi Ben,

I can access the repository files from the script section of a pipeline step. But how can I mount a folder or a file in my repository as a volume on a service container?

Thomas

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 15, 2022

Hey Ben,

Unfortunately, you are unable to mount volumes in Docker aside from the Bitbucket clone directory as this command has been restricted for security reasons due to requiring root privileges (see: Running docker commands heading)

https://support.atlassian.com/bitbucket-cloud/docs/run-docker-commands-in-bitbucket-pipelines/

Another user has raised a request to remove this restriction, you can "Watch" this feature request to receive updates related to it and "Vote" for it to increase its visibility in regard to customer demand:

https://jira.atlassian.com/browse/BCLOUD-22331

I have found this community post suggesting solutions for mapping the clone directory below:
https://community.atlassian.com/t5/Bitbucket-questions/Bitbucket-pipelines-does-Docker-volume-mounting-work-yet/qaq-p/703455

 

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

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

Atlassian Community Events