如何将docker图像从一个主机复制到另一个主机而不通过存储库? [英] How to copy docker images from one host to another without via repository?

查看:83
本文介绍了如何将docker图像从一个主机复制到另一个主机而不通过存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在不使用存储库的情况下将码头服务器图像从一台机器转移到另一台机器,无论是私人还是公共的?

How to transfer docker image from one machine to another one without using a repository, no matter 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.

由于它是基于自己的图像(如redhat),它无法从Dockerfile重新创建。

Since it is based on own based image (like redhat), it cannot be recreated from Dockerfile.

有没有可以使用的简单命令?或者另一个解决方案?

Are there any simple commands I can use? Or another solution?

更新似乎保存/导出可以达到类似的目的,请参阅在Docker中保存和导出有什么不同?,而我更喜欢保存命令为我的案例。

Updated It seems save/export can achieve similar purpose, see What is the difference between save and export in Docker?, and I prefer the save command for my case.

推荐答案

您将需要将docker图像保存为tar文件:

You will need to save the docker image as a tar file:

docker save -o <save image to path> <image name>

然后将图像复制到具有常规文件传输工具的新系统,例如 cp scp 。之后,您将不得不将图像加载到docker中:

Then copy your image to a new system with regular file transfer tools such as cp or scp. After that you will have to load the image into docker:

docker load -i <path to image tar file>

PS:您可能需要 sudo 命令。

PS: You may need to sudo all commands.

这篇关于如何将docker图像从一个主机复制到另一个主机而不通过存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆