How to copy Docker images from one host to another without using a repository

前端 未结 15 1810
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 13:37

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

I create my own image in VirtualBox, and wh

15条回答
  •  生来不讨喜
    2020-11-22 13:54

    I assume you need to save couchdb-cartridge which has an image id of 7ebc8510bc2c:

    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. I will use the /media/sf_docker_vm/ to save the image.

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

    Copy the archiveName.tar file to your new Docker instance using whatever method works in your environment, for example FTP, SCP, etc.

    Run the docker load command on your new Docker instance and specify the location of the image tar file.

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

    Finally, run the docker images command to check that 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
    

    Please find this detailed post.

提交回复
热议问题