Interview Prep/Docker/Image design and Dockerfile decisions

When is `docker commit` acceptable?

BeginnerScenarioImage design and Dockerfile decisions
Answer

Situation read → It snapshots a container's filesystem into an image.

What I'd do → Only for quick debugging or forensics (preserve a compromised container's state). Never for shipping: the result is not reproducible, has no recorded steps and can include secrets and caches.

Why → A Dockerfile in git is reviewable and rebuildable; a committed image is a black box.

Interview tip → docker diff <container> shows what changed, useful for turning manual fixes into Dockerfile lines.

All Docker questions Roadmap: Docker & containers

More on Image design and Dockerfile decisions