Get Notification: Monitor Your Docker Image Sizing

With Docker deployment, smaller images are usually better.

But your docker images will keep changing. And you just don’t remember to check it for a while. Then someday you happen to find out some huge images in your deployment pipeline. Feel uncomfortable, don’t you? Any thoughts about how to improve it?

My answer is like always: Monitor That! And Get Slack notifications.

Enclosed is my approach. Check it out! And discuss with me, my friends.

Get Notifcation: Monitor Your Docker Image Sizing


Original Article: http://dennyzhang.com/monitor_image_size

Update Per Audience Feedback:

Get Notifcation: Monitor Your Docker Image Sizing


Checking docker image size is super easy.

docker images | grep $image_name

We all want small images.

  1. The question is how small is small enough? It actually depends on your expectation, your project, etc.
  2. And you don’t set one expectation for all images, do you? More likely it would be some images should be less than 50MB, while some other should be less than 300MB, etc.

Examine it manually? It works.

But you can do better. I trust you! Maybe you can automate the check. What’s better, make the solution general. The same approach should apply to different projects with no extra effort.

Here comes my suggestion: detect_big_docker_image.py.

  1. By default, the script examines all docker images in the docker host machine.
  2. Different images can have different check threshold.
  3. We can skip check for certain docker images.

Why Python instead of Shell? (See GoodBye Shell, Hello Python!)

Get Notifcation: Monitor Your Docker Image Sizing

I love Jenkins. (See 5 Reasons Why Jenkins Is So Useful And Popular).

Thus I usually create a Jenkins job, which runs the check weekly.

Get Notifcation: Monitor Your Docker Image Sizing

If the job fails, I will get slack notifications.

Get Notifcation: Monitor Your Docker Image Sizing

More Reading:


Check our popular posts? Discuss with us on LinkedIn, Twitter Or NewsLetter.

Leave a Reply

Your email address will not be published. Required fields are marked *