docker migration and backup: save the container as a mirror, mirror export and import

Migration and Backup

1 The container is saved as an image

We can save the container as a mirror with the following command

docker commit mynginx mynginx_i

2 mirror backup

We can save the image as a tar file with the following command

docker  save -o mynginx.tar mynginx_i

3 Mirror recovery and migration

First, we delete the mynginx_img image and then execute this command to restore

docker load -i mynginx.tar

-i input file

Check the image again after execution, you can see that the image has been restored

Guess you like

Origin blog.csdn.net/a772304419/article/details/132383284