问题
I am trying to use the Docker layer cache in AWS CodeBuild. I have seen the effect when using it to reduce the time when building or pulling Docker image, but I found that it can only use local cache in a certain time period (about less than 1 hour). I have not seen any document about this.
Where did I get confused or do I have a way to set up the cache storage time?
Build caching in CodeBuild
回答1:
Local cache modes are best effort. They are available for a limited time after the build finishes. The S3 cache option for your artifacts are more durable, but they likely aren't well suited for Docker layers. We don't have documentation on it, as your mileage may vary.
If you run sparse builds, you are unlikely to see the benefits with local caching of your Docker layers. You may instead save and restore layer in Amazon ECR from your build container: https://github.com/aws/aws-codebuild-docker-images/issues/26#issuecomment-370177343.
In a future release, we will enable you to opt for backing up layers in your ECR registry.
来源:https://stackoverflow.com/questions/56710964/limited-time-when-using-local-cache-in-aws-codebuild