When modifying configuration files or installing packages inside an interactive Docker container, saving those changes into a new, reusable Docker image is performed using the docker commit command.
Docker Commit Command Workflow
# 1. Inspect container ID and modified files
docker ps
docker diff <CONTAINER_ID>
# 2. Commit container changes to a new image tag
docker commit -m "Installed customized Nginx config" -a "Developer" <CONTAINER_ID> custom-nginx:v1.0
# 3. Verify newly created image in local registry
docker images custom-nginx:v1.0
Comments and corrections