Docker exports the image as a tar file and imports it into the startup container

table of Contents

Save the image file

Restore image file


Requirement : In the actual use of docker, some machines cannot access the Internet, but some docker images are needed, so we can pull the docker image on the machine that can access the Internet, and then save it as a tar file, so that it can be used directly Used it on another machine.

Save the image file

1. Start the target image and view it, docker ps

2. Download the digapiss/axis mirror

docker save -o 镜像名字.tar digapiss/axis

3. Save in the current path by default

In this way we will save the image.

Restore image file

We will restore the saved image file, first delete the image we had at the beginning, if it is another machine, don't delete it.

1. First close the running container, then view the image, docker images, and then delete the image

 docker rmi -f 镜像名字

Has been deleted

2. Import the saved image

docker load --input axis1.4.tar

Check whether the pouring is successful, it can be seen that the pouring has been successful

3. Start the imported image

docker run -itd 镜像名字

It can be seen that the container has been started

Guess you like

Origin blog.csdn.net/qq_44159028/article/details/115003297