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

前端 未结 15 1728
爱一瞬间的悲伤
爱一瞬间的悲伤 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

    All other answers are very helpful. I just went through the same problem and figure out an easy way with docker machine scp.

    Since Docker Machine v0.3.0, scp was introduced to copy files from one Docker machine to another. This is very convenient if you want copying a file from your local computer to a remote Docker machine such as AWS EC2 or Digital Ocean because Docker Machine is taking care of SSH credentials for you.

    1. Save you images using docker save like:

      docker save -o docker-images.tar app-web
      
    2. Copy images using docker-machine scp

      docker-machine scp ./docker-images.tar remote-machine:/home/ubuntu
      

    Assume your remote Docker machine is remote-machine and the directory you want the tar file to be is /home/ubuntu.

    1. Load the Docker image

      docker-machine ssh remote-machine sudo docker load -i docker-images.tar
      

提交回复
热议问题