Docker commit Command

Docker commit Command

docker commit : Create a new image from a container.

Docker commit Syntax

docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]

OPTIONS Description.

  • -a : the author of the submitted image.
  • -c : The Dockerfile command to use to create the image.
  • -m : the description text at commit time.
  • -p : suspend the container at commit time.

Docker commit Example

Save the container a404c6c174a2 as a new image and add committer information and description information.

apidemos@apidemos:~docker commit -a "apidemos.com" -m "my apache" a404c6c174a2  mymysql:v1 
sha256:37af1236adef1544e8886be23010b66577647a40bc02c0885a6600b33ee28057
apidemos@apidemos:~ docker images mymysql:v1
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
mymysql             v1                  37af1236adef        15 seconds ago      329 MB
Like(0)