Docker 18.03 import and export

docker container and carve mirror, can be understood as the container is a simple example of the operation, the desired image is a running instance of static files.

Import and export operations can be done either on the container, may be the mirror operation. The difference is that the mirror can be exported at any time before they can be exported after the container must be stopped, otherwise not up and running when you export and then import the file, then import the container is mirrored not run directly. It need only be run after run.

Import container export

First check the operation of the vessel

docker ps -a

Add the -a parameter represents the view of all vessels, without - A parameter represents the view only vessel in operation

STATUS column have UP containers that represent the words of the running

Stop the container

docker stop testnginx

Export to a file container

docker export testnginx > nginx.tar

Nginx.tar then transmits the file to the other host docker, into a container, the container run

After the name into a vessel, 123 is introduced, after the introduction of the mirror type

docker import nginx.tar 123

View mirror after import

The image produced is a container operation

I do not know why the vessel can not run, has been in a state of E xited (0), there is the power of God, then please advise

Import and export mirroring

Listed Mirror

docker images

Export Mirror, nginx will be exported to a file nginx.tar.img

docker save -o nginx.tar.img nginx

The image transfer to other machines have introduced mirroring environment docker

docker load --input nginx.tar.img

View image import, image name after import to export when the image name. Irrespective of the root file name

Run-time image

docker run --name 332211 -p 8888:80 -d nginx

View running docker

Access the web browser to see if the project starts successfully

   

Guess you like

Origin www.cnblogs.com/withfeel/p/11611429.html