Hacker News
Read post

How I reduced the size of my very first published docker image by 40% - A lesson in dockerizing shell scripts

This post describes how the author reduced the size of a Docker image by 40% by using step-by-step optimization techniques, such as multi-stage builds. The author also discusses the use of tools like `docker-slim` and `docker-squash`. The final image size was 17.6 MB.

    #docker#alpinejs
Feb 03, 2024•18m read time•From bhupesh.me
Post cover image
Table of contents
The very first Dockerfile ~attempt~Path to optimization - reducing image size by 40%2nd attempt - alpine on alpine3rd attempt - Using scratch at 2nd stageEverything needed to run ugitCould we reduce the size further?You didn’t try docker-slim ?You didn’t try docker-squash ?LearningsAcknowledgementsResources
26 Impressions
Hacker News's image
Hacker News

Hacker News is a community-driven platform for sharing and discussing technology news, startups, and...

17.4K Followers

•

141.8K Upvotes

bhupeshimself's user avatar
Bhupesh Varshney
@bhupeshimself
Joined Jun 20. 2022
40

Would you recommend this post?

Copy link
WhatsApp
Facebook
X
New Squad
  • © 2026 Daily Dev Ltd.
  • Guidelines
  • Explore
  • Tags
  • Sources
  • Squads
  • Leaderboard