{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/13982","labels_url":"https://api.github.com/repos/docker/docker/issues/13982/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/13982/comments","events_url":"https://api.github.com/repos/docker/docker/issues/13982/events","html_url":"https://github.com/docker/docker/issues/13982","id":88954207,"number":13982,"title":"Ability to filter ADD / COPY during docker build, based on DIFF","user":{"login":"yaronr","id":6322020,"avatar_url":"https://avatars.githubusercontent.com/u/6322020?v=3","gravatar_id":"","url":"https://api.github.com/users/yaronr","html_url":"https://github.com/yaronr","followers_url":"https://api.github.com/users/yaronr/followers","following_url":"https://api.github.com/users/yaronr/following{/other_user}","gists_url":"https://api.github.com/users/yaronr/gists{/gist_id}","starred_url":"https://api.github.com/users/yaronr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yaronr/subscriptions","organizations_url":"https://api.github.com/users/yaronr/orgs","repos_url":"https://api.github.com/users/yaronr/repos","events_url":"https://api.github.com/users/yaronr/events{/privacy}","received_events_url":"https://api.github.com/users/yaronr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2015-06-17T08:31:30Z","updated_at":"2015-06-18T00:17:50Z","closed_at":null,"body":"Hi\r\nThis follows a short discussion on IRC with @duglin \r\n\r\nGoal: Minimize docker images\r\nMethod: Not copying files that already exist in the base image (or top layer), unless they are different\r\n\r\nUse case:\r\nWe have a base image, 'multicloud/common'. It includes a whole bunch of stuff, including a set of files under /workdir/lib (a bunch of .jar files, to be specific).\r\nWe use maven to run our builds, and maven copies dependencies to ./lib, for both the 'common' project, and the projects that depend on it. One of these projects, for example, is called 'agent', and is packaged in a docker image called 'multicloud/agent', which is FROM multicloud/common.\r\nAs mentioned before, when building 'agent', maven copies all of its dependencies (files) to /lib, including all of those that have been packaged under multicloud/common's workdir/lib.\r\nOf course, in the dockerfile for 'agent', I do a COPY (or ADD) ./lib /workdir/lib.\r\n\r\n99% of the files copied, are exactly the same (CRC-wise, and probably timestamp-wise) as those that are already on the top layer of the docker image file system. However, copy-on-write adds them to a new layer, effectively increasing the docker image size (dramatically, in some cases).\r\n\r\nIt would be great, if docker build's ADD or COPY command, had something similar to 'cp -u' - or even better - something that would calculate CRC32 of the files and copy them only if changed.\r\nIMO this could potentially dramatically decrease image sizes in many other use cases as well.\r\n"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/112984799","html_url":"https://github.com/docker/docker/issues/13982#issuecomment-112984799","issue_url":"https://api.github.com/repos/docker/docker/issues/13982","id":112984799,"user":{"login":"stevvooe","id":120601,"avatar_url":"https://avatars.githubusercontent.com/u/120601?v=3","gravatar_id":"","url":"https://api.github.com/users/stevvooe","html_url":"https://github.com/stevvooe","followers_url":"https://api.github.com/users/stevvooe/followers","following_url":"https://api.github.com/users/stevvooe/following{/other_user}","gists_url":"https://api.github.com/users/stevvooe/gists{/gist_id}","starred_url":"https://api.github.com/users/stevvooe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevvooe/subscriptions","organizations_url":"https://api.github.com/users/stevvooe/orgs","repos_url":"https://api.github.com/users/stevvooe/repos","events_url":"https://api.github.com/users/stevvooe/events{/privacy}","received_events_url":"https://api.github.com/users/stevvooe/received_events","type":"User","site_admin":false},"created_at":"2015-06-18T00:17:50Z","updated_at":"2015-06-18T00:17:50Z","body":"This sounds like an optimization. This should not be optional. A differential tree, like rsync, would be optimal, but it can cause file io (reads) on either side.\r\n\r\nMy only suggestion is that this not be implemented with CRC32. The hash should be sha256."}}