doruk.sonmez
doruk.sonmez

Reputation: 437

How to estimate compressed Docker image size before the push?

I have a private Docker registry based on Harbor. I know that Docker does its own compression just before pushing an image to the registry. However, local-to-registry compression ratio is never the same among the images. And registry wouldn't be able to pre-check and warn about the size of an incoming image since all the layers will be pushed concurrently.

Is it possible to pre-calculate the compressed size of an image before pushing it to the registry? Even an estimation would be great to have. Any idea regarding the subject will be much appreciated! Thanks in advance

Upvotes: 1

Views: 457

Answers (1)

Mohit Burkule
Mohit Burkule

Reputation: 161

docker save your_image | gzip > your_image.tar.gz

then check the size of your_image.tar.gz

For larger images use

docker image save ${list of repo:tags} | pigz --fast > ${target_path_to_archive}.tar.gz

Upvotes: 0

Related Questions