You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the mechanism used by compose to tar up the build context results in a different hash for ADD directives than that computed by docker build. This isn't a showstopper, but it does mean that for long and complicated builds work is done twice when it doesn't strictly need to be.
$ git clone https://gist.github.com/d679a4691d559d18aea8.git testcase
$ cd testcase
$ docker build .
$ docker-compose build web
Expected behaviour
The docker-compose build command uses the cached images generated by the preceding docker build command.
Actual behaviour
The docker-compose build command uses the cached images up until the ADD directive, which busts the cache and forces the remaining steps to be run again:
$ docker build .
Sending build context to Docker daemon 57.34 kB
Sending build context to Docker daemon
Step 0 : FROM busybox
---> 4986bf8c1536
Step 1 : RUN sleep 1
---> Running in c47334fb1fc3
---> 9f52371a6b61
Removing intermediate container c47334fb1fc3
Step 2 : ADD foo.txt ./
---> bca0b7a05b92
Removing intermediate container 74179c343ef4
Step 3 : RUN sleep 1
---> Running in 22219c266d47
---> 88757489d22f
Removing intermediate container 22219c266d47
Successfully built 88757489d22f
$ docker-compose build web
Building web...
Step 0 : FROM busybox
---> 4986bf8c1536
Step 1 : RUN sleep 1
---> Using cache
---> 9f52371a6b61
Step 2 : ADD foo.txt ./
---> 4a57b6d9cb05
Removing intermediate container 0c23f52f873f
Step 3 : RUN sleep 1
---> Running in 9acbacbf5f5b
---> c27815938ce2
Removing intermediate container 9acbacbf5f5b
Successfully built c27815938ce2
The text was updated successfully, but these errors were encountered:
As discussed with @bfirsh on IRC today.
It seems that the mechanism used by compose to tar up the build context results in a different hash for
ADD
directives than that computed bydocker build
. This isn't a showstopper, but it does mean that for long and complicated builds work is done twice when it doesn't strictly need to be.I've put a reduced testcase up as a Gist.
Steps to reproduce
Expected behaviour
The
docker-compose build
command uses the cached images generated by the precedingdocker build
command.Actual behaviour
The
docker-compose build
command uses the cached images up until theADD
directive, which busts the cache and forces the remaining steps to be run again:The text was updated successfully, but these errors were encountered: