Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD hashing not consistent with docker build #1093

Closed
nickstenning opened this issue Mar 11, 2015 · 3 comments
Closed

ADD hashing not consistent with docker build #1093

nickstenning opened this issue Mar 11, 2015 · 3 comments

Comments

@nickstenning
Copy link

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 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.

I've put a reduced testcase up as a Gist.

Steps to reproduce

$ 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
@dnephin
Copy link

dnephin commented Mar 11, 2015

I believe this is related to #883

@thaJeztah
Copy link
Member

Looks to be the same yes, also a simple repro-case in that issue; #883 (comment)

@dnephin
Copy link

dnephin commented Sep 18, 2015

Closing as duplicate of #883

We fixed some bugs with the docker-py .dockerignore implementation which may have fixed this.

@dnephin dnephin closed this as completed Sep 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants