Technical Blog Comprehension
3 exercises — read realistic developer blog posts about Docker image optimisation and Git workflows. Follow technical arguments, extract rules, and understand practical advice.
Reading technical blog posts effectively
- Numbered lists — often the main content; each item is a distinct point
- Before/after numbers — the payoff of the technique; memorise these
- Analogies ("like X for Y") — used to explain unfamiliar concepts quickly
- "Golden rule" / "Key principle" — the most important takeaway; always read carefully
- Code blocks — show the exact fix; read them alongside the prose explanation
0 / 3 completed
1 / 3
Passage: Docker Image Optimisation Blog Post
Title: Why Your Docker Images Are So Large (And How to Fix It) A common pain point for developers new to Docker is discovering their image is 1.2 GB when it only needs to be 80 MB. Here's why this happens and how to solve it. The most common culprits: 1. Using a full OS base image FROM ubuntu:22.04 adds ~80 MB immediately. But many apps don't need a full OS. Fix: Use minimal base images like alpine (5 MB) or distroless images. FROM node:18-alpine instead of FROM node:18 cuts the image from ~900 MB to ~170 MB. 2. Not using multi-stage builds If you compile code (Go, Java, TypeScript), the build tools don't belong in the final image. A multi-stage build compiles in one stage and copies only the binary to a clean final image. # Build stage FROM golang:1.21 AS builder WORKDIR /app COPY . . RUN go build -o server . # Final stage — no Go toolchain FROM alpine:3.19 COPY --from=builder /app/server . CMD ["./server"] Result: final image goes from ~800 MB (with Go toolchain) to ~12 MB. 3. Leaving package manager caches RUN apt-get install -y curl creates a cache that bloats the image. Fix: RUN apt-get install -y curl && apt-get clean && rm -rf /var/lib/apt/lists/* 4. Copying unnecessary files COPY . . copies everything, including node_modules, .git, and test files. Fix: Add a .dockerignore file (like .gitignore for Docker). Key principle: Every RUN, COPY, and ADD instruction creates a new layer. Unnecessary files added in one layer cannot be removed by a later layer. They must be excluded from the start.
According to the article, what is the result of using a multi-stage Docker build for a Go application?
From ~800 MB to ~12 MB:
The article states explicitly: "Result: final image goes from ~800 MB (with Go toolchain) to ~12 MB."
Why multi-stage builds work:
The Go toolchain (compiler, standard library, build tools) is needed to compile the binary but is NOT needed to run it. Multi-stage builds separate the compilation environment from the runtime environment. Only the compiled binary (
Technical blog comprehension tip:
Articles about optimisation typically use "before vs. after" examples with concrete numbers. These numbers are key information — they justify the technique. Look for pairs: the problem size and the solution size, the problem time and the solution time.
The article states explicitly: "Result: final image goes from ~800 MB (with Go toolchain) to ~12 MB."
Why multi-stage builds work:
The Go toolchain (compiler, standard library, build tools) is needed to compile the binary but is NOT needed to run it. Multi-stage builds separate the compilation environment from the runtime environment. Only the compiled binary (
./server) is copied to the final image.Technical blog comprehension tip:
Articles about optimisation typically use "before vs. after" examples with concrete numbers. These numbers are key information — they justify the technique. Look for pairs: the problem size and the solution size, the problem time and the solution time.