sometimes we want to save up and packaged into a new image.
You can use docker provides commit function.
Centos now, for example, mounted in vim editor centos above a bare,
and the preservation of this modification, the package can be performed as a mirror centos vim command.
1. boot image and make changes
docker run -it centos /bin/bash
[root @ afcaf46e8305 /] #
Note afcaf46e8305 container ID is generated when the front running -d Do not run in the background, or else the vessel can not enter the interactive execution mode:
Installation vim and exits the container:
yum the install -Y vim
Exit
2. The container packed into a mirror
docker commit afcaf46e8305 centos-vim
3. View Mirror centos-vim
docker images | grep centos-vim
view the details of the mirror:
Docker the Inspect CentOS-vim: afcaf46e8305
4. using this image centos-vim
docker run -it centos-vim / bin / bash
found vim can be used directly, and without the need to reinstall:
vim --version
5.OPTIONS Description
-a: Mirror of submission;
-c: Use Dockerfile command to create a mirror;
-m: Caption the time of filing;
-p: When commit, the container is suspended.
The container a404c6c174a2 saved as a new image, and add author information and description information.
docker commit -a "runoob.com" -m " my apache" a404c6c174a2 mymysql: v1