I have an image hosted in my private repos. I noticed that the same image in the remote repos has 50% smaller in size than the copy I have on my local machine after pulling (7GB vs 15GB). This image is built on IIS image. My question is does docker hub compressed image?
2 Answers
You can compress your image using docker save
command.
docker save your_image | gzip > your_image.tar.gz
Now run ls -hl
you will see the image is compressed and it size approximate decrease to its half or depend upon layer.
Save an image to a tar.gz file using gzip:
You can use gzip to save the image file and make the backup smaller.
docker save myimage:latest | gzip > myimage_latest.tar.gz
You can load the image or share the file with other so all the need to load it back as a docker image.
docker load < your_image.tar.gz
Load an image or repository from a tar archive (even if compressed with gzip, bzip2, or xz) from a file or STDIN. It restores both images and tags.
An example of centos which is around 200MB and the gzip file is just 70MB
So you can compress your local image the same and you can expect upto 7GB gzip file.
This is an old topic. You can check some discussions regarding this subject:
It seems like during docker push
the image is compressed. While the hub shows the compressed size (although not much clear about it) representing what will be over the network, docker-images
shows the uncompressed size.