There are a couple of ways to create images. One is by manually making changes inside a container and then committing the image. The other is to build one using a Dockerfile. In this recipe, we'll look at the former recipe and look at Dockerfiles later in the chapter.
As we start a new container, a read/write layer gets attached to it. This layer will get destroyed if we do not save it. In this recipe, we will learn how to save that layer and make a new image from the running or stopped container using the docker container commit command. The following is the syntax for the docker container commit command:
$ docker container commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]