docker commit: Create an Image from a Container
Snapshot a container into a new image - handy for debugging, not for builds.
docker commit creates a new image from a container current state. This page covers the flags and why reproducible builds should use a Dockerfile instead.
What it does
docker commit captures the writable layer of a container (changes since it started) as a new image layer, optionally setting config like CMD. Unlike a Dockerfile build, the result is opaque and not reproducible.
Common usage
docker commit mycontainer myimage:debug
docker commit -m "added patch" -a "me" mycontainer myimage:patched
docker commit --change "CMD [\"node\",\"server.js\"]" mycontainer myapp:snapCommon errors in CI
commit is fine for capturing a broken container to inspect later, but in CI prefer a Dockerfile: a committed image cannot be rebuilt from source, has no cache benefits, and hides what changed. If the new image "does nothing", you likely did not carry CMD over - set it with --change at commit time.