docker-commit
Create a new image from a container's changes
TLDR
View documentation for the original command
SYNOPSIS
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
PARAMETERS
-a, --author string
Author name and email (e.g., "John Doe" <john@example.com>)
-c, --change list
Apply Dockerfile instructions to the new image (e.g., CMD ["nginx", "-g", "daemon off;"])
-m, --message string
Commit message describing changes
-p, --pause
Pause container during commit (default true)
DESCRIPTION
The docker commit command captures the current state of a running or stopped container and saves it as a new Docker image. It creates a new image layer on top of the container's base image, incorporating all filesystem modifications, added files, and installed software made since the container started.
This is useful for quick prototyping, debugging, or creating custom images during development workflows. For example, you might run a container, install packages interactively, and commit the result to produce a ready-to-use image. The command outputs the new image ID and can optionally tag it with a repository name and tag.
By default, it pauses the container during the commit process to ensure a consistent snapshot, avoiding issues from ongoing writes. You can provide a commit message, author info, or apply Dockerfile-like changes (e.g., CMD, ENTRYPOINT) to the new image.
However, docker commit is generally discouraged for production use cases. It produces opaque, non-reproducible images since it doesn't record the sequence of commands or layers applied—only the end result. This hinders debugging, auditing, and collaboration. Instead, Docker strongly recommends using docker build with a Dockerfile for layered, scripted, and version-controlled image creation. Committed images are still fully functional for running containers, pushing to registries, or as bases for further builds.
CAVEATS
docker commit creates non-reproducible images; use Dockerfiles and docker build instead for best practices. Pausing may impact running services. Large containers take time to commit.
EXAMPLE
docker commit mycontainer myimage:v1
docker commit -m "Installed Apache" -a "Dev Team" mycontainer webserver:latest
HISTORY
Introduced in early Docker releases around 2013 as part of the core CLI for interactive image creation. Evolved with Docker Engine but de-emphasized in favor of declarative builds since Docker 1.0.
SEE ALSO
docker build(1), docker run(1), docker tag(1), docker push(1)


