I've been diving deep into managing Docker containers, specifically trying to strip down the ubuntu:latest image to reduce CVEs. I managed to cut the vulnerability count from over 200 to around 30, which felt like a big win. However, just two weeks later, every update I run seems to break something unexpected – missing dependencies, broken symlinks, you name it. Now I'm spending more time just trying to keep this thing working than I ever saved!
I'm curious if anyone has a more efficient approach to maintaining lean containers over the long term. I've heard some talk about distroless images, but I'm not sure if they would fit my needs. What are your strategies for keeping images slim while avoiding a maintenance nightmare?
5 Answers
Yep, it’s pretty much a time sink trying to manually gut a base image. Tools like distroless and platforms like Minimus help you avoid that and keep your images under control. Automate your builds and scanning process to manage updates without the headache.
Using a minimal base image like Alpine or a specialized one works wonders! You can also consider multistage builds - use one stage for building your app and a second stage to copy the built files into a clean image. This way, you keep things lean without having to strip packages off an existing distro.
Totally agree! I’m in on option two too!
Stripping down ubuntu isn't the best practice for hardened images. Instead, use a minimal image from the start. It saves time and effort in maintaining the containers, plus it avoids all those annoying dependency issues.
Exactly! It's about building up, not tearing down.
For sure! It's wild how much simpler it could’ve been!
If you’re tackling CVEs, using tools like Chainguard for pre-hardened minimal images is worth checking out. It simplifies things so that you don’t have to patch existing broken images constantly.
I’ve switched everything to Alpine, even if it meant some major rewrites. For any images that absolutely need Ubuntu, I just deploy them behind a load balancer to keep the risks from CVEs at bay.

Absolutely! Multistage builds are the way to go, much less hassle in the long run.