Docker Cache not working anymore
Asked by maiermic:

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

**bitbucket-pipelines.yml**

```
image: atlassian/default-image:4pipelines:  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:            - dockerdefinitions:  services:    docker:      memory: 7168  caches:    my-docker-cache:      key:        files:          - Dockerfile      path: docker-cacheoptions:  size: 2x
```

**Dockerfile**

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

Run 1 {#toc-hId--385811922}
---------------------------

```
+ docker load -i docker-cache/* || echo "No cache"open docker-cache/*: no such file or directoryNo cache+ docker build .Sending build context to Docker daemon  137.8MBStep 1/4 : FROM busybox:1.36.11.36.1: Pulling from library/busybox9ad63333ebc9: Pulling fs layer9ad63333ebc9: Verifying Checksum9ad63333ebc9: Pull completeDigest: sha256:6d9ac9237a84afe1516540f40a0fafdc86859b2141954b4d643af7066d598b74Status: Downloaded newer image for busybox:1.36.1 ---> 3f57d9401f8dStep 2/4 : RUN echo "first" ---> Running in 9f5db0912aa0first ---> Removed intermediate container 9f5db0912aa0 ---> aef0afc1d25eStep 3/4 : RUN echo "second" ---> Running in 6673f56d9742second ---> Removed intermediate container 6673f56d9742 ---> efd280830d9eStep 4/4 : RUN echo "third" ---> Running in cbb666b81938third ---> Removed intermediate container cbb666b81938 ---> 7d5f23f53603Successfully built 7d5f23f53603+ mkdir -p docker-cache && docker save $(docker images -aq) -o docker-cache/cache.tarBuild teardownAssembling contents of new cache 'my-docker-cache'Cache "my-docker-cache: docker-cache": Cache key 45d889b080d15a21c02bbb55a24c59ded2823339d2a3e51d237e8119a7a2fd79Cache "my-docker-cache: docker-cache": CompressingCache "my-docker-cache: docker-cache": Compressed in 0 secondsCache "my-docker-cache: docker-cache": Uploading 2.1 MiBCache "my-docker-cache: docker-cache": Uploaded in 1 secondsSearching for test report files in directories named [test-results, failsafe-reports, test-reports, TestResults, surefire-reports] down to a depth of 4Finished 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 {#toc-hId-2101700911}
---------------------------

```
Build Setup...Cache "my-docker-cache: docker-cache": Cache key 45d889b080d15a21c02bbb55a24c59ded2823339d2a3e51d237e8119a7a2fd79Cache "my-docker-cache: docker-cache": DownloadingCache "my-docker-cache: docker-cache": Downloaded 2.1 MiB in 0 secondsCache "my-docker-cache: docker-cache": ExtractingCache "my-docker-cache: docker-cache": Extracted in 0 seconds...+ docker load -i docker-cache/* || echo "No cache"Loaded image ID: sha256:7d5f23f53603a6c0cfc8f66a28a2abf0da920cd669c6bd60ed67f0c3a963c99dLoaded image ID: sha256:aef0afc1d25edf254e23a06940b2ff43c022fc8e0cc7d010d95d938a9b10869fLoaded image ID: sha256:efd280830d9e615ef6d0ec7353da56151e5a29c02f71c81e640144a986483cc3Loaded image ID: sha256:3f57d9401f8d42f986df300f0c69192fc41da28ccc8d797829467780db3dd741+ docker build .Sending build context to Docker daemon  142.3MBStep 1/4 : FROM busybox:1.36.11.36.1: Pulling from library/busyboxDigest: sha256:6d9ac9237a84afe1516540f40a0fafdc86859b2141954b4d643af7066d598b74Status: Downloaded newer image for busybox:1.36.1 ---> 3f57d9401f8dStep 2/4 : RUN echo "first" ---> Running in 455f29e76cb0first ---> Removed intermediate container 455f29e76cb0 ---> 2e82ca3f66eeStep 3/4 : RUN echo "second" ---> Running in 449de7072c2asecond ---> Removed intermediate container 449de7072c2a ---> 694a3cee4ae5Step 4/4 : RUN echo "third" ---> Running in b21aa5672cb9third ---> Removed intermediate container b21aa5672cb9 ---> d9162b45ec07Successfully built d9162b45ec07
```

Why are the layers in the second run not cached?


Answers:
author: Jos? Lucas
body: 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](https://confluence.atlassian.com/bbkb/infrastructure-changes-in-bitbucket-pipelines-1142431176.html).  

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](https://docs.docker.com/engine/release-notes/25.0/#2503).  

comments: author: maiermic
body: 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.


author: Patrik S
body: Hello [@maiermic](/t5/user/viewprofilepage/user-id/5282231) 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](/t5/user/viewprofilepage/user-id/5282231) !

Patrik S


Tags: bitbucket-cloud

cloud