You can create a new docker image by committing the changes in an existing using the following syntax:
sudo docker commit [CONTAINER_ID] [new_image_name]
Suppose there is a running docker with name “existing-image” (you can check with “docker ps -a”), the below common will commit the changes made in the running docker into the “new-image” image.
docker commit existing-image new-image