radial / core-busyboxplus

Full-chain/Internet enabled busybox images from scratch using Buildroot for flexible but light Docker volume containers. Comes in multiple flavors.
https://index.docker.io/u/radial/busyboxplus
48 stars 36 forks source link

docker build and docker import producing two different image sizes from same tar #2

Closed brianclements closed 10 years ago

brianclements commented 10 years ago

Linking from docker repo: https://github.com/dotcloud/docker/issues/4883

Tested using Jerome's Dockerfile with addition of git, same issue:

$ sudo docker images
REPOSITORY             TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
bb-mod-imported        latest              0b70f28bf858        3 minutes ago       10.65 MB
bb-mod-added           latest              4d1674bcc89c        8 minutes ago       144.5 MB
brianclements commented 10 years ago

Solved.

Ok, so for archival purposes, here is why my rootfs.tar image produced via buildroot, and built with git (the issue only showed up when git was installed), seemed to magically inflate to over 150mb once imported into docker

Git-core

I checked out the contents of git-core on my Ubuntu Trusty build. It includes a couple binaries, but interestingly, many more symlinks, bash and perl scripts (I always wondered why git needed to compile with perl, now I know). Anyway, the git suite is a mosh of scripts and binaries that all link up in various ways. Here is the contents of my git-core on Ubuntu:

total 14M
drwxr-xr-x   3 root root  20K May  3 16:22 .
drwxr-xr-x 254 root root  80K May  2 11:24 ..
-rwxr-xr-x   1 root root 1.6M Apr 10 02:28 git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-add -> git
-rwxr-xr-x   1 root root  36K Apr 10 02:28 git-add--interactive
-rwxr-xr-x   1 root root  23K Apr 10 02:28 git-am
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-annotate -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-apply -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-archive -> git
-rwxr-xr-x   1 root root  12K Apr 10 02:28 git-bisect
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-bisect--helper -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-blame -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-branch -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-bundle -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-cat-file -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-check-attr -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-check-ignore -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-check-mailmap -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-checkout -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-checkout-index -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-check-ref-format -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-cherry -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-cherry-pick -> git
-rwxr-xr-x   1 root root  99K Apr 10 02:35 git-citool
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-clean -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-clone -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-column -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-commit -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-commit-tree -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-config -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-count-objects -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-credential -> git
-rwxr-xr-x   1 root root 744K Apr 10 02:28 git-credential-cache
-rwxr-xr-x   1 root root 752K Apr 10 02:28 git-credential-cache--daemon
-rwxr-xr-x   1 root root 748K Apr 10 02:28 git-credential-store
-rwxr-xr-x   1 root root 760K Apr 10 02:28 git-daemon
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-describe -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-diff -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-diff-files -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-diff-index -> git
-rwxr-xr-x   1 root root  14K Apr 10 02:28 git-difftool
-rwxr-xr-x   1 root root 2.0K Apr 10 02:28 git-difftool--helper
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-diff-tree -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-fast-export -> git
-rwxr-xr-x   1 root root 780K Apr 10 02:28 git-fast-import
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-fetch -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-fetch-pack -> git
-rwxr-xr-x   1 root root  12K Apr 10 02:28 git-filter-branch
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-fmt-merge-msg -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-for-each-ref -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-format-patch -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-fsck -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-fsck-objects -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-gc -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-get-tar-commit-id -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-grep -> git
-rwxr-xr-x   1 root root  99K Apr 10 02:35 git-gui
-rwxr-xr-x   1 root root 1.4K Apr 10 02:35 git-gui--askpass
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-hash-object -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-help -> git
-rwxr-xr-x   1 root root 752K Apr 10 02:28 git-http-backend
-rwxr-xr-x   1 root root 780K Apr 10 02:28 git-http-fetch
-rwxr-xr-x   1 root root 792K Apr 10 02:28 git-http-push
-rwxr-xr-x   1 root root 756K Apr 10 02:28 git-imap-send
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-index-pack -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-init -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-init-db -> git
-rwxr-xr-x   1 root root  18K Apr 10 02:28 git-instaweb
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-log -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-ls-files -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-ls-remote -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-ls-tree -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-mailinfo -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-mailsplit -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-merge -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-merge-base -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-merge-file -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-merge-index -> git
-rwxr-xr-x   1 root root 2.2K Apr 10 02:28 git-merge-octopus
-rwxr-xr-x   1 root root 3.5K Apr 10 02:28 git-merge-one-file
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-merge-ours -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-merge-recursive -> git
-rwxr-xr-x   1 root root  944 Apr 10 02:28 git-merge-resolve
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-merge-subtree -> git
-rwxr-xr-x   1 root root 8.2K Apr 10 02:28 git-mergetool
-rw-r--r--   1 root root 7.4K Apr 10 02:28 git-mergetool--lib
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-merge-tree -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-mktag -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-mktree -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-mv -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-name-rev -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-notes -> git
-rwxr-xr-x   1 root root  101 Apr 10 02:28 git-p4
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-pack-objects -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-pack-redundant -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-pack-refs -> git
-rw-r--r--   1 root root 2.3K Apr 10 02:28 git-parse-remote
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-patch-id -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-prune -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-prune-packed -> git
-rwxr-xr-x   1 root root 8.3K Apr 10 02:28 git-pull
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-push -> git
-rwxr-xr-x   1 root root 3.3K Apr 10 02:28 git-quiltimport
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-read-tree -> git
-rwxr-xr-x   1 root root  16K Apr 10 02:28 git-rebase
-rw-r--r--   1 root root 1.6K Apr 10 02:28 git-rebase--am
-rw-r--r--   1 root root  27K Apr 10 02:28 git-rebase--interactive
-rw-r--r--   1 root root 3.2K Apr 10 02:28 git-rebase--merge
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-receive-pack -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-reflog -> git
-rwxr-xr-x   1 root root 4.1K Apr 10 02:28 git-relink
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-remote -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-remote-ext -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-remote-fd -> git
lrwxrwxrwx   1 root root   15 Apr 10 02:28 git-remote-ftp -> git-remote-http
lrwxrwxrwx   1 root root   15 Apr 10 02:28 git-remote-ftps -> git-remote-http
-rwxr-xr-x   1 root root 796K Apr 10 02:28 git-remote-http
lrwxrwxrwx   1 root root   15 Apr 10 02:28 git-remote-https -> git-remote-http
-rwxr-xr-x   1 root root 764K Apr 10 02:28 git-remote-testsvn
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-repack -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-replace -> git
-rwxr-xr-x   1 root root 3.8K Apr 10 02:28 git-request-pull
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-rerere -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-reset -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-revert -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-rev-list -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-rev-parse -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-rm -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-send-pack -> git
-rwxr-xr-x   1 root root 744K Apr 10 02:28 git-shell
-rw-r--r--   1 root root 2.0K Apr 10 02:28 git-sh-i18n
-rwxr-xr-x   1 root root 740K Apr 10 02:28 git-sh-i18n--envsubst
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-shortlog -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-show -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-show-branch -> git
-rwxr-xr-x   1 root root 740K Apr 10 02:28 git-show-index
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-show-ref -> git
-rw-r--r--   1 root root  14K Apr 10 02:28 git-sh-prompt
-rw-r--r--   1 root root 8.0K Apr 10 02:28 git-sh-setup
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-stage -> git
-rwxr-xr-x   1 root root  14K Apr 10 02:28 git-stash
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-status -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-stripspace -> git
-rwxr-xr-x   1 root root  32K Apr 10 02:28 git-submodule
-rwxr-xr-x   1 root root  16K Apr 10 02:28 git-subtree
-rwxr-xr-x   1 root root  61K Apr 10 02:35 git-svn
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-symbolic-ref -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-tag -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-unpack-file -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-unpack-objects -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-update-index -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-update-ref -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-update-server-info -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-upload-archive -> git
-rwxr-xr-x   1 root root 764K Apr 10 02:28 git-upload-pack
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-var -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-verify-pack -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-verify-tag -> git
-rwxr-xr-x   1 root root 4.3K Apr 10 02:28 git-web--browse
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-whatchanged -> git
lrwxrwxrwx   1 root root    3 Apr 10 02:28 git-write-tree -> git
drwxr-xr-x   2 root root 4.0K Apr 21 10:29 mergetools

When looking at the git-core directory in my buildroot, it told a very different story:

total 145984
drwxr-xr-x    3 root     root        4.0K May  3 07:31 .
drwxr-xr-x    3 root     root        4.0K May  3 07:28 ..
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-add
-rwxr-xr-x    1 root     root       36.0K May  3 07:28 git-add--interactive
-rwxr-xr-x    1 root     root       22.5K May  3 07:28 git-am
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-annotate
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-apply
-rwxr-xr-x    1 root     root       36.1K May  3 07:28 git-archimport
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-archive
-rwxr-xr-x    1 root     root       11.7K May  3 07:28 git-bisect
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-bisect--helper
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-blame
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-branch
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-bundle
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-cat-file
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-check-attr
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-check-ignore
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-check-mailmap
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-check-ref-format
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-checkout
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-checkout-index
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-cherry
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-cherry-pick
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-clean
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-clone
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-column
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-commit
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-commit-tree
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-config
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-count-objects
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-credential
-rwxr-xr-x    1 root     root      591.7K May  3 07:31 git-credential-cache
-rwxr-xr-x    1 root     root      599.4K May  3 07:31 git-credential-cache--daemon
-rwxr-xr-x    1 root     root      596.9K May  3 07:31 git-credential-store
-rwxr-xr-x    1 root     root       12.6K May  3 07:28 git-cvsexportcommit
-rwxr-xr-x    1 root     root       31.3K May  3 07:28 git-cvsimport
-rwxr-xr-x    1 root     root      158.6K May  3 07:28 git-cvsserver
-rwxr-xr-x    1 root     root      603.6K May  3 07:31 git-daemon
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-describe
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-diff
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-diff-files
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-diff-index
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-diff-tree
-rwxr-xr-x    1 root     root       13.3K May  3 07:28 git-difftool
-rwxr-xr-x    1 root     root        1.9K May  3 07:28 git-difftool--helper
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-fast-export
-rwxr-xr-x    1 root     root      621.3K May  3 07:31 git-fast-import
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-fetch
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-fetch-pack
-rwxr-xr-x    1 root     root       11.4K May  3 07:28 git-filter-branch
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-fmt-merge-msg
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-for-each-ref
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-format-patch
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-fsck
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-fsck-objects
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-gc
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-get-tar-commit-id
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-grep
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-hash-object
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-help
-rwxr-xr-x    1 root     root      599.6K May  3 07:31 git-http-backend
-rwxr-xr-x    1 root     root      601.6K May  3 07:31 git-imap-send
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-index-pack
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-init
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-init-db
-rwxr-xr-x    1 root     root       17.8K May  3 07:28 git-instaweb
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-log
-rwxr-xr-x    1 root     root         554 May  3 07:28 git-lost-found
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-ls-files
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-ls-remote
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-ls-tree
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-mailinfo
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-mailsplit
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-merge
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-merge-base
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-merge-file
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-merge-index
-rwxr-xr-x    1 root     root        2.2K May  3 07:28 git-merge-octopus
-rwxr-xr-x    1 root     root        3.4K May  3 07:28 git-merge-one-file
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-merge-ours
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-merge-recursive
-rwxr-xr-x    1 root     root         944 May  3 07:28 git-merge-resolve
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-merge-subtree
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-merge-tree
-rwxr-xr-x    1 root     root        8.2K May  3 07:28 git-mergetool
-rw-r--r--    1 root     root        7.4K May  3 07:28 git-mergetool--lib
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-mktag
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-mktree
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-mv
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-name-rev
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-notes
-rwxr-xr-x    1 root     root      118.9K May  3 07:28 git-p4
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-pack-objects
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-pack-redundant
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-pack-refs
-rw-r--r--    1 root     root        2.1K May  3 07:28 git-parse-remote
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-patch-id
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-peek-remote
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-prune
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-prune-packed
-rwxr-xr-x    1 root     root        8.4K May  3 07:28 git-pull
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-push
-rwxr-xr-x    1 root     root        3.3K May  3 07:28 git-quiltimport
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-read-tree
-rwxr-xr-x    1 root     root       14.9K May  3 07:28 git-rebase
-rw-r--r--    1 root     root        1.4K May  3 07:28 git-rebase--am
-rw-r--r--    1 root     root       26.5K May  3 07:28 git-rebase--interactive
-rw-r--r--    1 root     root        3.0K May  3 07:28 git-rebase--merge
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-receive-pack
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-reflog
-rwxr-xr-x    1 root     root        4.1K May  3 07:28 git-relink
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-remote
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-remote-ext
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-remote-fd
-rwxr-xr-x    1 root     root      611.4K May  3 07:31 git-remote-testsvn
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-repack
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-replace
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-repo-config
-rwxr-xr-x    1 root     root        3.7K May  3 07:28 git-request-pull
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-rerere
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-reset
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-rev-list
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-rev-parse
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-revert
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-rm
-rwxr-xr-x    1 root     root       42.9K May  3 07:28 git-send-email
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-send-pack
-rw-r--r--    1 root     root        1.9K May  3 07:28 git-sh-i18n
-rwxr-xr-x    1 root     root       19.0K May  3 07:31 git-sh-i18n--envsubst
-rw-r--r--    1 root     root        8.0K May  3 07:28 git-sh-setup
-rwxr-xr-x    1 root     root      592.8K May  3 07:31 git-shell
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-shortlog
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-show
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-show-branch
-rwxr-xr-x    1 root     root      591.3K May  3 07:31 git-show-index
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-show-ref
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-stage
-rwxr-xr-x    1 root     root       13.1K May  3 07:28 git-stash
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-status
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-stripspace
-rwxr-xr-x    1 root     root       31.2K May  3 07:28 git-submodule
-rwxr-xr-x    1 root     root       60.1K May  3 07:28 git-svn
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-symbolic-ref
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-tag
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-tar-tree
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-unpack-file
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-unpack-objects
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-update-index
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-update-ref
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-update-server-info
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-upload-archive
-rwxr-xr-x    1 root     root      605.3K May  3 07:31 git-upload-pack
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-var
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-verify-pack
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-verify-tag
-rwxr-xr-x    1 root     root        4.3K May  3 07:28 git-web--browse
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-whatchanged
-rwxr-xr-x    1 root     root        1.2M May  3 07:31 git-write-tree
drwxr-xr-x    2 root     root        4.0K May  3 07:28 mergetools

I was wondering why so many files were exactly the same size. It's because buildroot somehow recompiled the entire git binary (~1.2mb) for every component in the git suite instead of symlinking them. I found out that not all these files are neccesary either. They are there to allow for modularity of the git-core componets and to call them individually. So all redundant binaries that are neither script nor symlink can safely be deleted and the size brought down again.

Docker

So why did Docker report two different filesizes? I think it's the nature of how busybox compiles things and makes images. What keeps busybox small is compiling everything at once so that it reuses code. This was succesfully done in the final rootfs.tar image as it was around 16mb. So that the base git binary was compiled once, and every single git binary was simply being pointed to that binary if it was to be used again. But untaring it manually or as part of ADD in docker build (which untars any tarfiles automatically) somehow confuses tar into thinking that it needs to copy over the git binary code into every binary that was linked to it, and that's what it did, bringing the filesize up astronomically.

This is also why docker import worked fine because it just copied bit for bit what the tar image contained keeping the internal references to the git binary at all, keeping it small.

Busyboxplus

Since most of the core git functionality is contained in the original git core binary, we can safely delete all the redundant binaries, perl, and bash scripts to bring the filesize back down to where we want it. We also must do this because in order to make trusted builds (at least for the moment), the only way to import an image is in the context of a docker build command using a Dockerfile and ADD. Thus we need to tinker with the final rootfs.tar image in the ways listed above.