I have build Docker images on a CentOS 7 (Docker version 1.13.1, build b2f74b2) and a Fedora 29 (v18.09.3) node based on the same Dockerfile and also cross checked that the Dockerfiles have the identical hash
sha256sum Dockerfile | cut -b 1-16 38e6a42c5c01a1ac
and build the containers with
docker build --build-arg RUN=20190503.centos -t container:20190503.centos .
For comparison/later loading, I saved the images into tarballs.
docker save --output /var/tmp/image_20190503.desktop.tar batch:20190503.desktop
I would have expected, that the final tarballs should be same in size as they are based on the same Dockerfiles. Bowever, the image tarballs differed significantly
container 20190503.desktop 2e3e545f245d About an hour ago 6.6 GB container 20190503.centos afebf959a752 About an hour ago 9.7 GB -rw------- 1 root root 9,2G May 3 12:44 /var/tmp/container_20190503.centos.tar -rw------- 1 root root 6,3G May 3 12:53 /var/tmp/container_20190503.desktop.tar
(the large size is due to unfortunate 'external' requirements)
(also the size estimation by Docker on the overall layers space seems to be a bit at odds with the final tarballs)
Is there a reason, why Docker image saves should have different sizes when build form the same Dockerfile but on different versions of Docker/OS?