π» Docker Image Shamer - Python Script
Publicly shame bloated Docker images with automated size checks and meme roasts
#!/usr/bin/env python3
"""
Docker Image Shamer - Automatically shame bloated Docker images
"""
import docker
import requests
import json
from datetime import datetime
class DockerImageShamer:
def __init__(self, image_name):
self.client = docker.from_env()
self.image_name = image_name
self.roasts = [
"Your image is so fat, it needs its own zip code",
"This container is thicker than a bowl of oatmeal",
"Your Dockerfile looks like a shopping list",
"Even your base image is judging you",
"This isn't a container, it's a storage unit"
]
def analyze_image(self):
"""Pull and analyze Docker image size"""
try:
# Pull the image
image = self.client.images.pull(self.image_name)
# Get image size in MB
size_bytes = image.attrs['Size']
size_mb = size_bytes / (1024 * 1024)
# Generate roast based on size
roast = self._generate_roast(size_mb)
return {
'image': self.image_name,
'size_mb': round(size_mb, 2),
'roast': roast,
'timestamp': datetime.now().isoformat()
}
except Exception as e:
return {'error': str(e)}
def _generate_roast(self, size_mb):
"""Generate appropriate roast based on image size"""
if size_mb > 1000:
return "π¨ EMERGENCY: " + self.roasts[0]
elif size_mb > 500:
return "π₯ HOT MESS: " + self.roasts[1]
elif size_mb > 200:
return "π¬ YIKES: " + self.roasts[2]
else:
return "π SUSPICIOUS: " + self.roasts[3]
# Usage example:
if __name__ == "__main__":
# Shame your own image
shamer = DockerImageShamer("your-image:latest")
result = shamer.analyze_image()
if 'error' not in result:
print(f"π¦ Image: {result['image']}")
print(f"π Size: {result['size_mb']} MB")
print(f"π€ Roast: {result['roast']}")
print(f"β° Checked: {result['timestamp']}")
The Problem: Your Docker Images Are a Hot Mess
Let's be honest - Docker has become the digital equivalent of that junk drawer in your kitchen. You know the one. It's where you throw everything from expired coupons to that weird screwdriver you've never used. Your Docker images are no different. You start with a slim Alpine base, then add 'just one more package' for debugging, then another for 'future-proofing,' and before you know it, you've created a digital behemoth that requires its own zip code.
Why does this happen? Because checking Docker images is about as exciting as watching paint dry. You've got better things to do - like scrolling through memes or pretending to work while actually planning your lunch. So you push that 4GB image to production, pat yourself on the back, and call it a day. Meanwhile, your security team is having panic attacks, your CI/CD pipeline moves slower than a sloth on sedatives, and your cloud bill looks like the national debt of a small country.
The worst part? Everyone knows. Your colleagues whisper about your 'chonky' containers in Slack. Your DevOps engineer cries silently at their desk. Even your IDE judges you. But nobody says anything because that would require actual work. So the cycle continues: build, ignore, deploy, regret. Rinse and repeat until your production environment resembles a digital hoarder's paradise.
The Solution: Public Shaming as a Service
Enter Docker Image Shamer - the tool that weaponizes embarrassment for the greater good. I built this because I was tired of my own terrible Docker habits. I needed something that would call me out so brutally that I'd actually fix my images. Something that would make me feel the shame I deserved.
Here's how it works: Docker Image Shamer scans your Dockerfiles or running images and performs three critical checks. First, it measures the size and gives you brutally honest feedback like 'This image is so fat, when it sits around the house, it sits AROUND the house.' Second, it checks for outdated packages with messages like 'Your packages are older than the concept of good UI design.' Third, it scans for known CVEs with warnings like 'This image has more security holes than a plot in a Michael Bay movie.'
The genius part? It's actually useful. Behind the hilarious shame messages is real, actionable data. You get specific package names, version comparisons, CVE IDs, and remediation suggestions. The humor just makes the medicine go down easier. Plus, when you can optionally post these shame reports to your team's Slack or Teams channel complete with embarrassing GIFs, suddenly everyone becomes very motivated to write better Dockerfiles.
How to Use It (Prepare for Humiliation)
Installation is simple - because if it were complicated, you'd never use it (we know you). Just clone the repository and install the dependencies:
git clone https://github.com/BoopyCode/docker-image-shamer-1767253092.git
cd docker-image-shamer
pip install -r requirements.txtBasic usage is even simpler. Want to shame a Dockerfile? Run:
python shamer.py --dockerfile ./DockerfileWant to shame a running container? Even better:
python shamer.py --container my-chonky-appHere's a taste of what the actual code looks like (from the main shamer.py file):
def generate_shame_message(image_size_mb):
if image_size_mb > 1000:
return "π¨ This image is so fat, it has its own gravitational pull. \n" \
" NASA is considering studying it as a new celestial body."
elif image_size_mb > 500:
return "π€‘ Your image is thicker than a bowl of oatmeal. \n" \
" Did you include the entire internet as a dependency?"
else:
return "π¦ Not terrible, but we've seen slimmer. \n" \
" Maybe try removing that copy of Windows 95 you included?"Check out the full source code on GitHub to see all the glorious, shame-inducing features.
Key Features That Will Make You Blush
- Comprehensive Scanning: Scans Dockerfiles or running images for size, outdated packages, and known CVEs. It's like a full-body scan for your containers, except instead of finding polyps, it finds your terrible life choices.
- Sarcastic Shame Messages: Generates meme-based roasts that are funnier than your stand-up comedian friend who's 'just trying material.' Examples include 'Your packages are so outdated, they still think Y2K is a concern' and 'This image has more layers than my emotional issues.'
- Team Integration: Optionally posts shame reports to Slack/Teams channels with embarrassing GIFs. Nothing motivates change like public humiliation in front of your coworkers.
- Actionable Insights: Behind the jokes are real suggestions for improvement. It tells you exactly which packages to update, what to remove, and how to slim down your image.
- CI/CD Ready: Integrates into your pipeline to prevent shameful images from reaching production. Because prevention is better than explaining to your boss why your app is slower than dial-up.
Conclusion: Embrace the Shame
Docker Image Shamer isn't just a tool - it's an intervention for your container hygiene. By turning technical debt into social embarrassment, it taps into the most powerful motivator known to developers: not wanting to look stupid in front of our peers. The benefits are real: smaller images, faster deployments, better security, and lower cloud bills. Plus, you get to laugh while improving your code, which is basically the developer equivalent of having your cake and eating it too.
So go ahead - try it out. Let Docker Image Shamer roast your containers into submission. Your future self (and your teammates) will thank you. And if nothing else, at least you'll have some hilarious error messages to screenshot for your next stand-up meeting.
Remember: A shamed Docker image is a Docker image that gets fixed. Now if only someone would build a similar tool for my life choices...
Quick Summary
- What: Docker Image Shamer scans your Docker images for bloat, outdated packages, and security vulnerabilities, then roasts them with hilarious shame messages.
π¬ Discussion
Add a Comment