5

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
  • Which image are you refering to?
    – Pierre B.
    Commented Sep 20, 2019 at 13:29
  • @PierreB.I updated my orginial post for clarity.
    – KMC
    Commented Sep 20, 2019 at 13:41

2 Answers 2

6

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

save docker image

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

enter image description here

So you can compress your local image the same and you can expect upto 7GB gzip file.

0
5

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.