Bitbucket Pipeline Doesn't Use the Docker-in-Docker Daemon
Asked by Huacong Cai:

I am trying to use *docker buildx* command (used by *docker compose build* ) and according to this [KB article](https://confluence.atlassian.com/bbkb/building-multi-architecture-docker-images-with-bitbucket-pipelines-1252329371.html), it seems that I could use the custom docker-in-docker image to get the latest docker and achieve that. However, after setting up the docker image ([another instructions](https://support.atlassian.com/bitbucket-cloud/docs/configure-your-runner-in-bitbucket-pipelines-yml/#Custom-docker-in-docker-image)), running *docker --version* still invokes the built-in docker daemon, what am I missing?

Runner version: 1.551  

Bitbucket Config

It is using the custom docker name since the default name didn't work and I was trying to see if using a custom name would make the pipeline refer to the custom docker daemon.

![Screenshot 2024-01-16 at 09.47.22.png](/t5/image/serverpage/image-id/300808iE0E7703607A05413/image-dimensions/493x112?v=v2 "Screenshot 2024-01-16 at 09.47.22.png")![Screenshot 2024-01-16 at 09.47.34.png](/t5/image/serverpage/image-id/300809iDA7F91AF535C1E3E/image-dimensions/453x239?v=v2 "Screenshot 2024-01-16 at 09.47.34.png")

Running results

Docker log shows the dind is running

![Screenshot 2024-01-16 at 09.49.30.png](/t5/image/serverpage/image-id/300810i98BDD3309DBAF423/image-size/large?v=v2&px=999 "Screenshot 2024-01-16 at 09.49.30.png")

The pipeline still calls the built-in docker CLI

![Screenshot 2024-01-16 at 09.49.12.png](/t5/image/serverpage/image-id/300811iF0CBBAEA31D1C101/image-size/large?v=v2&px=999 "Screenshot 2024-01-16 at 09.49.12.png")


Answers:
author: Syahrul
body: G'day, [@Huacong Cai](/t5/user/viewprofilepage/user-id/5404517)

Welcome to the community.

It appears that you are using Golang image, so I wonder if the experimental feature is enabled. Could you revisit the [guide](https://confluence.atlassian.com/bbkb/building-multi-architecture-docker-images-with-bitbucket-pipelines-1252329371.html) again and make sure to follow the steps to enable the Docker experimental feature as well as moved the build plugin?

below is the example YAML:

    pipelines:  default:    - step:        name: My Runner        image: atlassian/default-image:4        runs-on:          - linux          - self.hosted        services:          - docker        script:          - echo "Executing on self-hosted runner"           - export DOCKER_CLI_EXPERIMENTAL=enabled # Enable usage of buildx in Docker version < 23          - export BUILDX_VERSION=0.11.0  # define what BUILDX_VERSION to download and install          - curl -fsSLO https://github.com/docker/buildx/releases/download/v${BUILDX_VERSION}/buildx-v${BUILDX_VERSION}.linux-amd64          - mkdir -p $HOME/.docker/cli-plugins/ && mv buildx-v${BUILDX_VERSION}.linux-amd64 $HOME/.docker/cli-plugins/docker-buildx && chmod +x ~/.docker/cli-plugins/docker-buildx # download buildx and move it to the docker plugin folder          - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes; docker buildx create --use # setup the QEMU emulation environment          - echo $DOCKER_HUB_PASS | docker login --username $DOCKER_HUB_USER --password-stdin # login to Dockerhub           - docker buildx build -t $DOCKER_HUB_USER/my_image_multi_arch:my_tag --push --platform linux/amd64,linux/arm64,linux/arm/v7 . # Build multi-architecture image for the platforms provided and push to Dockerhubdefinitions:  services:    docker: # Define a custom docker daemon - can only be used with a self-hosted runner      image: docker:dind

Regards,  
Syahrul


Tags: bitbucket-cloud

cloud