Docker commit Command
docker commit: Create a new image from a container's changes.
Syntax
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
OPTIONS Description:
-
-a: Author for the image commit;
-
-c: Use Dockerfiles instructions to create the image;
-
-m: Commit message;
-
-p: Pause the container during commit.
Example
Save the container a404c6c174a2 as a new image, and add author and description information.
tutorialpro@tutorialpro:~$ docker commit -a "tutorialpro.org" -m "my apache" a404c6c174a2 mymysql:v1
sha256:37af1236adef1544e8886be23010b66577647a40bc02c0885a6600b33ee28057
tutorialpro@tutorialpro:~$ docker images mymysql:v1
REPOSITORY TAG IMAGE ID CREATED SIZE
mymysql v1 37af1236adef 15 seconds ago 329 MB