Missed Team ’24? Catch up on announcements here.

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

Docker Cache not working anymore

maiermic February 6, 2024

If I remember correctly, the caching of this example worked before:

bitbucket-pipelines.yml

image: atlassian/default-image:4

pipelines:
  custom:
    test-build-docker-image:
      - step:
          name: Build Docker image
          script:
            - export DOCKER_BUILDKIT=0
            - docker load -i docker-cache/* || echo "No cache"
            - docker build .
            - mkdir -p docker-cache && docker save $(docker images -aq) -o docker-cache/cache.tar
          caches:
            - my-docker-cache
          services:
            - docker

definitions:
  services:
    docker:
      memory: 7168
  caches:
    my-docker-cache:
      key:
        files:
          - Dockerfile
      path: docker-cache

options:
  size: 2x

 Dockerfile

FROM busybox:1.36.1
RUN echo "first"
RUN echo "second"
RUN echo "third"

Run 1

+ docker load -i docker-cache/* || echo "No cache"
open docker-cache/*: no such file or directory
No cache

+ docker build .
Sending build context to Docker daemon  137.8MB
Step 1/4 : FROM busybox:1.36.1
1.36.1: Pulling from library/busybox
9ad63333ebc9: Pulling fs layer
9ad63333ebc9: Verifying Checksum
9ad63333ebc9: Pull complete
Digest: sha256:6d9ac9237a84afe1516540f40a0fafdc86859b2141954b4d643af7066d598b74
Status: Downloaded newer image for busybox:1.36.1
 ---> 3f57d9401f8d
Step 2/4 : RUN echo "first"
 ---> Running in 9f5db0912aa0
first
 ---> Removed intermediate container 9f5db0912aa0
 ---> aef0afc1d25e
Step 3/4 : RUN echo "second"
 ---> Running in 6673f56d9742
second
 ---> Removed intermediate container 6673f56d9742
 ---> efd280830d9e
Step 4/4 : RUN echo "third"
 ---> Running in cbb666b81938
third
 ---> Removed intermediate container cbb666b81938
 ---> 7d5f23f53603
Successfully built 7d5f23f53603

+ mkdir -p docker-cache && docker save $(docker images -aq) -o docker-cache/cache.tar

Build teardown

Assembling contents of new cache 'my-docker-cache'
Cache "my-docker-cache: docker-cache": Cache key 45d889b080d15a21c02bbb55a24c59ded2823339d2a3e51d237e8119a7a2fd79
Cache "my-docker-cache: docker-cache": Compressing
Cache "my-docker-cache: docker-cache": Compressed in 0 seconds
Cache "my-docker-cache: docker-cache": Uploading 2.1 MiB
Cache "my-docker-cache: docker-cache": Uploaded in 1 seconds
Searching for test report files in directories named [test-results, failsafe-reports, test-reports, TestResults, surefire-reports] down to a depth of 4
Finished scanning for test reports. Found 0 test report files.
Merged test suites, total number tests is 0, with 0 failures and 0 errors.

Run 2

Build Setup
...
Cache "my-docker-cache: docker-cache": Cache key 45d889b080d15a21c02bbb55a24c59ded2823339d2a3e51d237e8119a7a2fd79
Cache "my-docker-cache: docker-cache": Downloading
Cache "my-docker-cache: docker-cache": Downloaded 2.1 MiB in 0 seconds
Cache "my-docker-cache: docker-cache": Extracting
Cache "my-docker-cache: docker-cache": Extracted in 0 seconds
...

+ docker load -i docker-cache/* || echo "No cache"
Loaded image ID: sha256:7d5f23f53603a6c0cfc8f66a28a2abf0da920cd669c6bd60ed67f0c3a963c99d
Loaded image ID: sha256:aef0afc1d25edf254e23a06940b2ff43c022fc8e0cc7d010d95d938a9b10869f
Loaded image ID: sha256:efd280830d9e615ef6d0ec7353da56151e5a29c02f71c81e640144a986483cc3
Loaded image ID: sha256:3f57d9401f8d42f986df300f0c69192fc41da28ccc8d797829467780db3dd741

+ docker build .
Sending build context to Docker daemon  142.3MB
Step 1/4 : FROM busybox:1.36.1
1.36.1: Pulling from library/busybox
Digest: sha256:6d9ac9237a84afe1516540f40a0fafdc86859b2141954b4d643af7066d598b74
Status: Downloaded newer image for busybox:1.36.1
 ---> 3f57d9401f8d
Step 2/4 : RUN echo "first"
 ---> Running in 455f29e76cb0
first
 ---> Removed intermediate container 455f29e76cb0
 ---> 2e82ca3f66ee
Step 3/4 : RUN echo "second"
 ---> Running in 449de7072c2a
second
 ---> Removed intermediate container 449de7072c2a
 ---> 694a3cee4ae5
Step 4/4 : RUN echo "third"
 ---> Running in b21aa5672cb9
third
 ---> Removed intermediate container b21aa5672cb9
 ---> d9162b45ec07
Successfully built d9162b45ec07

Why are the layers in the second run not cached?

2 answers

1 vote
José Lucas
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!
February 15, 2024

Facing the same issue here.

It seems to be related to version 25.0.2 of Docker, which was updated on February 2nd, according to the report at the following link:
Infrastructure Changes in Bitbucket Pipelines.

It appears to have been resolved in version 25.0.3. Here's the link to the release notes: Docker Engine Release Notes - 25.0.3.

maiermic March 5, 2024

Support told me that version 25.0.3 does not fix the issue. They downgraded the Docker version of my workspace till a fix for a newer Docker version is available. Caching works again with the downgraded version.

Like # people like this
1 vote
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 13, 2024

Hello @maiermic and thank you for reaching out to Community!

I will raise an internal ticket to further investigate the pipeline issue you are facing. You should be receiving an email with the ticket link soon. In case you don't receive it, please let me know so I can share the ticket here in the community (the ticket is only visible to you and Atlassian staff).

Thank you, @maiermic !

Patrik S

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events