How Docker image copied from one host to another host without using repository

本文翻译自:How to copy Docker images from one host to another without using a repository

How do I transfer a Docker image from one machine to another one without using a repository, no matter private or public? How Docker image transfer without using a repository from one computer to another computer, whether it is private or public?

I am used to play and create my own image in VirtualBox, and when it is finished, I try to deploy to other machines to have real usage. I used to play and create your own image in VirtualBox, after completion, I try to deploy to other computers to practical use.

Since it is based on own based image (like Red Hat Linux), it can not be recreated from a Dockerfile. Because it is based on your own image (such as Red Hat Linux), and therefore can not be re-created from Dockerfile.

Are there simple commands I can use? I can use a simple command it? Or another solution? Or other solutions?

Seems the Save IT / Export CAN the Achieve A Similar Purpose, See the What IS at The -difference the BETWEEN the Save and Export in Docker? It seems to save / export can achieve a similar purpose, see What is the difference between Docker save and export? , And the I the prefer at The savethe Command for My Case. , For my case, I prefer to use savethe command.


#1st Floor

Reference: How Docker copy the image to another host without https://stackoom.com/question/1cQcf/ a repository from a host


#2nd Floor

For a flattened export of a container's filesystem, use; to a flat file system export containers, use;

docker export CONTAINER_ID > my_container.tar

Use cat my_container.tar | docker import - use cat my_container.tar | docker import - cat my_container.tar | docker import -to import said image. cat my_container.tar | docker import -Image


#3rd floor

You will need to save the Docker image as a tar file: You will need to Docker image is saved as a tar file:

docker save -o <path for generated tar file> <image name>

A Copy your Image to the Then new new System with Regular File Transfer Tools SUCH AS cp, scpor rsync(of Preferred for Big Files). Then use conventional file transfer tool (for example cp, scpor rsync(preferred) for large files terms) to copy the images to the new system. After that you will have to load the image into Docker: After that, you have to be in the image is loaded into Docker:

docker load -i <path to image tar file>

PS: May need to by You sudoAll Commands. PS: You may need to all commands sudo.

EDIT: You should add filename (not just directory) with -o, for example: Edit: You should use the -o add the file name (not just the directory), for example:

docker save -o c:/myfile.tar centos:16

#4th floor

The ASSUME you need to the Save the I couchdb-cartridgeWhich of the above mentioned id has 7ebc8510bc2c AN Image: I assume you need to save it as a picture ID 7ebc8510bc2c of couchdb-cartridge:

stratos@Dev-PC:~$ docker images
REPOSITORY                             TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
couchdb-cartridge                      latest              7ebc8510bc2c        17 hours ago        1.102 GB
192.168.57.30:5042/couchdb-cartridge   latest              7ebc8510bc2c        17 hours ago        1.102 GB
ubuntu                                 14.04               53bf7a53e890        3 days ago          221.3 MB

Save the archiveName image to a tar file . Save the image to archiveName tar file. At The by Will use the I /media/sf_docker_vm/to the Save at The Image. I will use the /media/sf_docker_vm/saved image.

stratos@Dev-PC:~$ docker save imageID > /media/sf_docker_vm/archiveName.tar

At The archiveName.tar to your File Copy new new Docker instance a using Method, Whatever Works in your Environment, for Example FTP, SCP, etc. using any method available in the environment to copy the files to a new archiveName.tar Docker instances, for example FTP, SCPand so on.

At The RUN docker loadthe Command ON your new new instance and the Specify at The Docker LOCATION. Of tar at The Image File to run on the new Docker instance docker loadcommand, and specify the location of the image tar file.

stratos@Dev-PC:~$ docker load < /media/sf_docker_vm/archiveName.tar

A finally, at The RUN docker imagesthe Command to the Check that the Available now at The Image IS. Finally, run the docker imagescommand to check if the image is now available.

stratos@Dev-PC:~$ docker images
REPOSITORY                             TAG        IMAGE ID         CREATED             VIRTUAL SIZE
couchdb-cartridge                      latest     7ebc8510bc2c     17 hours ago        1.102 GB
192.168.57.30:5042/couchdb-cartridge   latest     bc8510bc2c       17 hours ago        1.102 GB
ubuntu                                 14.04      4d2eab1c0b9a     3 days ago          221.3 MB

The Find the this Please the Detailed POST . Please find the detailed post .


#5th Floor

A Docker Image Via SSH Transferring, bzipping at The Content ON at The Fly: SSH transport by Docker image and instantly bzip content:

docker save <image> | bzip2 | \
     ssh user@host 'bunzip2 | docker load'

Also A Good IDEA's IT to PUT pvin at The Middle of at The pipe See How to Transfer at The IS going: the pvin the middle of the pipeline is also a good idea to view the transmission process:

docker save <image> | bzip2 | pv | \
     ssh user@host 'bunzip2 | docker load'

(More info the About pv: Home Page , man Page ). (About pvmore information: Home , man pages ).


#6th floor

To save an image to any file path or shared NFS place see the following example. To save the image to any share or NFS file path location, see the following example.

Get the image id by doing: acquiring an image ID by performing the following operations:

sudo docker images

Say you have an image with id " matrix-data". Suppose you have an ID of "Data Matrix" picture.

Save the image with id: save the image having an ID:

sudo docker save -o /home/matrix/matrix-data.tar matrix-data

Copy the image from the path. To any host to copy the image from the path to any host. Now import to your local Docker installation using : Now, use the following command into the local Docker installation:

sudo docker load -i <path to copied image file>
Original articles published 0 · won praise 73 · views 550 000 +

Guess you like

Origin blog.csdn.net/w36680130/article/details/105267500