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,300,072
Community Members
 
Community Events
165
Community Groups

Does Bitbucket Pipelines support docker buildx?

Example:

docker buildx build --platform linux/amd64,linux/arm64 -t "$IMAGE_NAME" --push .

1 answer

0 votes

@Monica Gordillo Currently building multi-arch images is only supported using a self-hosted runner. An example can be found here

Are there any plans on supporting this in the cloud runners? The point of using bitbucket cloud is to not self host things.

@Mathieu Lemay Yes, we will be supporting it on cloud runners. We are currently currently blocked by a bug in BuildKit. We will be enabling BuildKit on cloud runner once the bug is fixed or when we find a workaround.

Hi @Justin Thomas @Mathieu Lemay , it seems that there's a new docker version where the bug may be fixed (version 20.10.15). Did you try it? See https://github.com/moby/buildkit/issues/2087#issuecomment-1121740254

 

Thanks in advance!

Norbert C Atlassian Team Jun 21, 2022

HI @Xavier Serrat Bordas 

Thank you for your reply. I'd like to inform you that we've already rolled out the upgrade to Docker 20.10.15. You can read further about this upgrade on the following site: https://community.atlassian.com/t5/Bitbucket-articles/Bitbucket-Pipelines-Docker-client-upgrade/ba-p/2056982

Best Regards,
Norbert
Atlassian Bitbucket Cloud Support

Like # people like this

Thanks Norbert! I'm going to take a look

Hi, I checked the new docker upgrade and it looks that the buildx plugin is not available OOTB.

- Running with the default docker image:

name: 'Verify docker'
services:
 - docker
script:
 - docker version
 - docker buildx create buildx-context
 - docker buildx build --platform linux/amd64,linux/arm64 --push -f Dockerfile -t buildx-check:latest .

The output is:

docker buildx create buildx-context<1s
+ docker buildx create buildx-context
docker: 'buildx' is not a docker command.
See 'docker --help'

 

Doing some more research I tried to run:

name: 'Verify docker'
image: docker:20.10.15
services:
- docker
script:
- docker version
- docker buildx create buildx-context
- docker buildx build --platform linux/amd64,linux/arm64 --push -f Dockerfile -t buildx-check:latest .
The buildx plugin looks fine, I can create buildx context:
+ docker buildx create buildx-context
friendly_sinoussi

However, when I try to run buildx build:
+ docker buildx build --platform linux/amd64,linux/arm64 --push -f Dockerfile -t buildx-check:latest .
#1 [internal] booting buildkit
#1 pulling image moby/buildkit:buildx-stable-1
#1 pulling image moby/buildkit:buildx-stable-1 4.1s done
#1 creating container buildx_buildkit_default 0.0s done
#1 ERROR: Error response from daemon: authorization denied by plugin pipelines: --privileged=true is not allowed
------
> [internal] booting buildkit:
------
error: Error response from daemon: authorization denied by plugin pipelines: --privileged=true is not allowed

we have no permissions to to that.

Any suggestions?
Like Elia Perenzin likes this

It seems like privileged is not supported on bitbucket pipelines. Therefore you can not use buildx.

What you could do is to build the containers separately and combine them into a manifest.

pipelines:
default:
- step:
image: docker:20.10.15
services:
- docker
script:
- docker build --platform linux/amd64 -t pipeline-test:amd64 .
- docker build --platform linux/arm64 -t pipeline-test:arm64 .
- docker manifest create pipeline-test:latest pipeline-test:amd64 pipeline-test:arm64
- docker manifest push pipeline-test:latest

 Don't forget to add DOCKER_BUILDKIT=1 to repository variables.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,255 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you