Docker's container saves images, backups, and restores

1. Save the container as a mirror image
We can save the container as a mirror image with the following command

docker commit redis myredis

eg: The specific operation is as follows     

docker ps -a[查看有哪些容器]  
docker commit nginx mynginx[备份nginx容器为mynginx镜像]  
docker run -di --name=mynginx mynginx[部署myngxin的容器]  
dokcer ps -a[查看所有容器]  

2. Image backup
        We can save the image as a tar file with the following command
        docker save -o myredis.tar myredis
        -o output What does the output mean
        eg: Back up the image of mynginx, and back it up as a mynginx.tar file
        docker save -o mynginx. tar mynginx
3. Image restoration and migration
        First, we delete the myredis image first, and then execute this command to restore the file entered by
        docker load -i myredis.tar
        -i input.
        After execution, check the image again, and you can see that it has been restored

The whole operation is as follows

Guess you like

Origin blog.csdn.net/www1056481167/article/details/114837769