How to properly run docker compose v2 on bitbucket pipeline?

Dawid Cichoń
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!
December 22, 2023

 I am attempting to run Docker Compose on Bitbucket Pipeline, and I came across this code on Stack Overflow (https://stackoverflow.com/questions/72744395/how-to-use-docker-compose-v2-in-bitbucket-pipelines) that seems promising. However, upon running it, I encounter the following error:

 

Error response from daemon: authorization denied by plugin pipelines: --privileged=true is not allowed

 

In my search for a solution, I came across this Atlassian Confluence page: https://confluence.atlassian.com/bbkb/docker-buildkit-error-in-pipelines-when-deploying-to-google-cloud-1235859715.html

Unfortunately, the suggested solution provided on the Confluence page did not resolve the issue. Even after adding the line:

 
export PATH=/usr/bin:$PATH


I observed no changes. Additionally, altering the DOCKER_BUILDKIT variable did not work with my Docker Compose in version 24.

Is there any functional example of Docker Compose in Bitbucket Pipeline that you can recommend? I appreciate any assistance you can provide.

2 answers

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 2, 2024

Hi @Dawid Cichoń and welcome to the community!

For Pipelines builds that run on Atlassian's infrastructure we've had to restrict certain docker options. You can find details on the documentation below:

--privileged is one of the options we have restricted. Are you using privileged: true in your docker-compose.yml file?

The Confluence article you found is specific only to some Docker images that are used as build containers.

If you'd like me to investigate further your specific issue, I would need to know the content of your bitbucket-pipelines.yml file and the content of your docker-compose.yml.

The restrictions on the documentation page I shared do not apply to builds running on a self-hosted runner. If you have your own machine where you can run builds, you could also look into using one of our self-hosted runners:

Please feel free to let me know if you have any questions.

Kind regards,
Theodora

0 votes
Bilal Mughal
Contributor
December 22, 2023

 

image: docker:20.10.8

pipelines:
default:
- step:
name: Build and deploy
script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker-compose build
- docker-compose push

Bilal Mughal
Contributor
December 22, 2023

use this code 

Like Sebastiaan Jansen likes this
Dawid Cichoń
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!
January 1, 2024

Thanks, I checked it and it kinda works.

When I do docker compose up I get this error: Error response from daemon: authorization denied by plugin pipelines: --mounts is not allowed

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events