Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,555,983
Community Members
 
Community Events
184
Community Groups

Buildkit cache-from not working

I'm checking the newly available feature in the pipeline for the docker buildkit. Trying to utilize the build cache feature to improve the build speed. But after some tests, I noticed the cache layer can't be reused consistently. 

The build command I used is

docker build orch-tool --tag image-name --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from image-name-at-registry
docker tag image-name image-name-at-registry
docker push image-name-at-registry

I tested the above commands locally without issue, and the caching works perfectly. But when tested in the pipeline, it doesn't work.

The dockerfile contains `apt update` in early layers, not sure if this is the problem.

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 12, 2022

Hi @Thor Zhong,

 

(1) Does caching not work at all in Pipelines?
Or does it not work in some builds?
Or does it work only for some layers?

I am trying to understand the scope of the issue you are reporting.

 

(2) Have you added the following command in the script of your bitbucket-pipelines.yml file (before the docker build command)?

- export DOCKER_BUILDKIT=1

This is necessary in order to be able to use Docker BuildKit in Bitbucket Pipelines.

 

(3) Are you using this in Pipelines builds that run in our own infrastructure, or have you set up runners that run in your own infrastructure?

 

Kind regards,
Theodora

1. The cache works in some builds. But failed more often I can feel

2. Yes, I did this export

3. I'm using runners from bitbucket infrastructure. 

For example, I ran three builds one after another. They all have the same sha256 (not sure if you can see it clearly) at the same layer, but build 12 used the cache layer while build 15 did apt installation again. I think build 12 ran 1 day after build 11 finished, build 15 ran 4 days after

#11No11.png

#12

No12.png

#15

No15.png

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 17, 2022

Hi @Thor Zhong,

Thank you for the info.

My guess is that there may be a change between the different Pipelines builds either in the base image you are using in your Dockerfile or in one of the tools you are installing with the apt install command, which makes the dependencies get downloaded again.

Are you using a public Docker image as a base image in the Dockerfile? If so, would you mind sharing which image it is and also the full list of tools you are installing with apt install, so I can try to reproduce and investigate?

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events