Bitbucket Cloud - Issue with --cache-from option for cloud pipeline runners using docker buildKit

Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.

Summary

As per the documentation the recommended build layers need to be cached. The option is to use the Docker Build --cache-from option with Docker BuildKit enabled. However, the Docker remote layer cache doesn't work as expected and displays the following message in the build log:

1 "One or more build-args [BUILDKIT_INLINE_CACHE] were not consumed."

Solution

The docker remote layer caching may not work with the docker daemon version on cloud pipelines, as the default 'docker' system service utilizes a restrictive/secured docker image in the cloud pipelines environment, and it's not possible to change it.

To address this, consider exploring the option of using pipeline self-hosted runners with a custom docker image to mitigate the problem.

Below is a sample configuration using the latest docker:dind image:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 definitions: services: docker: image: docker:dind memory: 4500 # Can be changed pipelines: default: - step: name: 'Build and Test' size: 2x runs-on: linux services: - docker script: - export DOCKER_BUILDKIT=1 - cd test1 - docker build --cache-from atlassian/default-image:3 --build-arg BUILDKIT_INLINE_CACHE=1 .

Sample docker layer remote cache pipeline output:

1 2 #1 importing cache manifest from abc/abc-abc:latest #2 sha256:daf02ceec6f9d435a7964a11ba6a565e2184b4a6a935381d5ca2bd6e8ca2521a
Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.