-
Bug
-
Resolution: Unresolved
-
Medium
-
None
-
8
-
Severity 3 - Minor
-
8,678
-
Issue Summary
In Bitbucket Pipelines, docker-cached layers from previous builds are not being used in subsequent builds.
The docker cache is successfully generated and uploaded in the initial pipeline. It's downloaded in the next step, but it's not used by docker, which is building the layers from scratch.
Steps to Reproduce
- Create a pipeline and have a step configured to do a docker build , and to use the docker pre-defined cache
pipelines: custom: test-build-docker-image: - step: name: Build Docker image script: - docker build . caches: - docker services: - docker
- Run the pipeline the first time. It will generate a cache with the docker image built layers and upload it to Bitbucket.
- Run the pipeline a second time. It will now download the previously generated cache, but docker will not use the cache layers and will build each layer again from scratch.
Expected Results
Docker should use the cached layers from the previous build if no change was applied to that layer in the Dockerfile
Actual Results
Docker is using the previous cache layers.
Workaround
Currently there is no known workaround for this behavior. A workaround will be added here when available
I am seeing the same thing in my projects. Cache gets built, pushed, loaded and not used.
Building the image locally does use the cache as expected.