In order to decrease Docker image build time on dynamically provisioned EC2 boxes I decided to use the following method: - run 'docker-compose build' on the master host nightly - clone whole /var/lib/docker dir from the master host to the new box - run 'docker-compose build' on the new box; and if relevant files wasn't modified, build should use cache. But - in fact Docker doesn't use cache. I noticed that build process on the new host produced different hash for the same file (I mean - for the file with the same content).
In this post https://hackernoon.com/working-with-the-docker-build-cache-to-autoscale-our-jenkins-nodes-37b63a3dd2a different mtime was explanation for docker cache invalidation. But as far as I tested, mtime doesn't affect hash value, produced by Docker build. What I'm missing?
Thanks, Vitaly
I'm using Docker version 18.06.1-ce and docker-compose version 1.23.1 on Ubuntu 16.04.