• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Medium Medium
    • Pipelines - Caching
    • None

      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

      1. 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
        
      2. Run the pipeline the first time. It will generate a cache with the docker image built layers and upload it to Bitbucket.
      3. 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

            [BCLOUD-23193] Docker cache is not being used in Bitbucket Pipelines

            Ezequiel added a comment -

            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.

            Ezequiel added a comment - 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.

            Please fix this asap! Our CI pipeline is so slow due to this

            Simon Tegelid added a comment - Please fix this asap! Our CI pipeline is so slow due to this

            How is lack of caching not a priority fix?  This burns build minutes and slows down deployments and the CI cycle.  This should be a basic feature of a cloud pipeline that uses docker.

            Bryant Foresman added a comment - How is lack of caching not a priority fix?  This burns build minutes and slows down deployments and the CI cycle.  This should be a basic feature of a cloud pipeline that uses docker.

            Hello, we are also lacking this feature.. we do have public images in AWS registry containing all our dependencies (except our software code)... we would really like to speed up this build time, specially needed when we have to deploy hotfixes urgently.

            Thank you

            Henrique Haas added a comment - Hello, we are also lacking this feature.. we do have public images in AWS registry containing all our dependencies (except our software code)... we would really like to speed up this build time, specially needed when we have to deploy hotfixes urgently. Thank you

              Unassigned Unassigned
              641e77b2eb21 Patrik S
              Affected customers:
              25 This affects my team
              Watchers:
              31 Start watching this issue

                Created:
                Updated: