Build duration and critical paths
Worked example
This is an offline lesson. Data are fictional and Docker commands are unexecuted. Any optional execution requires an authorized disposable VM, a verified context, synthetic data, restricted access and no external transmission. Do not collect secrets or private output. Before any separately authorized Docker query, verify the effective endpoint and builder (including environment overrides), not just the context name. Use only disposable lab resources; a failed check is a stop condition, not permission to retry against a different host.
Illustrative dependency graph (seconds, not observed):context=2; independent stages A=12 and B=8;final assembly depends on both=3; export=4.Serial estimate: 2+12+8+3+4 = 29 sIdeal overlap: 2+max(12,8)+3+4 = 21 sStaged command for an approved local builder:docker buildx build --progress=plain --load -t bm29-demo:trial .The critical path is the longest dependent chain, not the sum of every parallel step. The example assumes perfect overlap and no contention; real CPU, storage and memory contention can change both durations. Use plain build progress to identify expensive operations, and measure the complete command separately because exporting/loading may dominate. Keep the output mode identical: a cache-only build is not comparable to one loading an image. Record the builder driver and platform. Make the context small with a reviewed .dockerignore, but never omit required input. Separate independent stages only when they really are independent; check resulting artifacts and final image behavior. Use native builds where appropriate and measure emulation separately. No registry upload or download is required for this worksheet. The staged build is illustrative; no Dockerfile for bm29-demo is supplied. Do not execute it against an arbitrary working directory. Ideal overlap assumes all independent stages can run together, with no overlapping context or export time. Record actual end-to-end results only after an approved local builder, input and free tag are established.
Common mistake
Adding all reported step durations can overstate elapsed time when steps overlap. Use end-to-end timing and inspect dependencies.
Manual practice
Given context=3, A=18, B=9, final=4, export=5 seconds, compute serial and ideal overlap estimates. Explain why adding more parallel work may increase real elapsed time.
Worksheet: lab-fixtures/docker-performance-engineering/02-build-duration/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Build duration and critical paths — Knowledge check
Interpret performance evidence and make a safe operational decision.
What is the ideal overlap estimate in the example?
Why record output mode?
Does BuildKit guarantee ideal parallel speedup?