In order to create an image, we first need to determine the container's id:
C:\> docker ps -a
> docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
282465b50140 mcr.microsoft.com/windows/nanoserver:1809 "cmd.exe" 31 minutes ago Exited (0) 3 seconds ago fervent_nightingale
83926cacc71d mcr.microsoft.com/windows/nanoserver:1809 "cmd.exe" About an hour ago Exited (0) 31 minutes ago musing_morse
…
Use docker commit to create a new image, named a_new_image. Note that image names need to be lowercase:
C:\> docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
a_new_image latest a80b39c04ea8 35 seconds ago 253MB
hello-world latest 16464c76a19c 9 days ago 251MB
mcr.microsoft.com/windows/nanoserver 1809 c897e7c62e1e 3 weeks ago 251MB
…
Run the newly created container:
C:\> docker run a_new_image cmd.exe /c type date-time.txt
Fri 12/20/2019
02:05 PM