Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Docker Buildkit Caching

Edward Williams
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!
May 5, 2025

I was reading the documentation here (https://support.atlassian.com/bitbucket-cloud/docs/run-docker-commands-in-bitbucket-pipelines/#Enable-Docker-BuildKit) and I noticed an apparent discrepancy. 

Docker BuildKit caching limitations
The predefined docker cache used for caching the layers produced during Docker Build operations does not cache layers produced when using BuildKit.

which then appears to conflict with this:

Docker layer caching
If you have added Docker as a service, you can also add a Docker cache to your steps. Adding the cache can speed up your build by reusing previously built layers and only creating new dynamic layers as required in the step.

I have also had issues with priviledged mode when trying to cache using buildkit.

Additionally, in the documentation on caches it says: "Caches are saved on successful builds when the cache is empty. Only caches under 1GB once compressed are saved."

So a larger docker image won't get cached at all between pipelines?

 

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 6, 2025

Hi Edward,

Essentially those two pieces of documentation you've quoted means the following:

  • The docker service can be cached by adding a cache section in your YML configuration
  • The only layers that won't be cached, are BuildKit layers

We have documentation related to privileged mode issues using buildkit below:

You are correct in stating that any docker image above 1GB will not be cached, I'd recommend using a smaller image.

Cheers!

- Ben (Bitbucket Cloud Support)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events