DEV Community

François
François

Posted on • Originally published at blog.lepape.me on

Troubleshoot suspiciously big docker images

Yesterday, I was working on deploying features/PRs environments on the fly for a multi-tenancy Laravel app. To help me with this task where I had to jump between code, YAML files, and docker files, I used skaffold which is great to package all the standard steps "build, push, deploy" into one simple: skaffold dev

At one point I ran out of disk space so I decided to give a look at my docker images, to my dismay, I saw the php-fpm docker image was 3.67 GB big.

Let me introduce you to a beautiful tool called dive.

This tool lets you track layer by layer what is taking disk space in your docker image. It is so good, thanks to it I've found a residual 900 Mb Laradock folder imported twice in the docker image.

It makes it super easy to inspect what folders/files you could add to your .dockerignore that you may have forgotten.

│ Image Details ├───────────────────────────────────

Image name: r******g/***fpm***:468xcbb5-dirty
Total Image size: 614.04 MB
Potential wasted space: 2.8 MB
Image efficiency score: 99 %
Enter fullscreen mode Exit fullscreen mode

They even have a CI option!

Top comments (0)