(3) Export the image file

method one:

     This is only to export the initial image directly, but does not export the container in the subsequent added data, which can be understood as exporting only an empty shell

docker images

sudo docker save -o mysql_20171108.tar ggk-mysql:5.6.33

 

Method Two:

In order to save the original data, the container needs to be created as a new image, and the image can be preserved

 

[root@localhost~]# docker ps –a

[root@localhost~]# docker stop 1c208c37e520

[root@localhost~]# docker ps –a

[root@localhost~]# sudo docker commit -m "Added a new file" -a "DockerNewbee" 1c208c37e520 mysql_20180202 :mysql ( not added here, the TAG in the mirror defaults to latest)

[root@localhost~]# docker images

[root@localhost~]# sudo docker save -o mysql_20180202.tar mysql_20180202:mysql


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325516598&siteId=291194637