是否有使用Docker的聪明方法(也许通过save/load/diff)? [英] Is there a clever way to do this with Docker (maybe via save/load/diff)?

查看:74
本文介绍了是否有使用Docker的聪明方法(也许通过save/load/diff)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多可以在其上运行代码的计算机.但是,我只能在会话"中这样做,在这两个会话之间没有文件系统持久性.我至少可以在这些会话之外将文件上传到这些主机,并且这种情况仍然存在.基本上,这些计算机不会下载任何内容,但是我可以选择显式发送文件.

I have a large number of computers on which I can run code. However, I can only do so in "sessions", between which there is no file system persistence. I do at least have the ability outside of these sessions to upload files to these hosts and this does persist. Basically, nothing these computers download themselves sticks, but I can choose to explicitly send them files.

带宽是这些计算机上的重要商品.

Bandwidth is a big commodity on these computers.

现在,在这些计算机上,我运行各种docker映像.如果我 docker pull 一些图像,它将在下一个会话中消失.我发现我可以在计算机上 docker保存图像,将其上传到它们(这样就可以粘贴),然后在每个会话开始时,他们可以 docker加载.在实践中,我将它们发送给debian:wheezy,因为它们所需的大多数其他映像均基于此,因此即使每个会话仍在重复下载,至少它只是debian:wheezy之上的更改.

Now, on these computers I run various docker images. If I docker pull some image, its going to be gone by the next session. I figured out that I can docker save an image on my computer, upload it to them (so it sticks), then at the beginning of every session they can docker load. In practice I'm sending them debian:wheezy, since most other images they need are based on that, thus even though there's still downloading repeated every session, at least its only the changes ontop of debian:wheezy.

我的问题如下.假设我将基本的debian:wheezy更改为我们可以称为debian:cheesy的内容(不是直接交换,而是在图像树中出现了wheezy的内容),这大大增加了它的大小.另外,我将来的所有图像现在都将基于俗气,因此我现在想将俗气的图像上传到计算机.

My problem is as follows. Suppose I change the base debian:wheezy to something which we can call debian:cheesy (not a straight swap, something such that wheezy is in the image tree for cheesy), and that this significantly increases its size. Also, all my future images are now going to be based on cheesy, so I now want to upload cheesy to my computers.

有没有一种方法可以使它们俗气地发送,而又不以某种方式重新发送与Wheezy相关的数据?

Is there a way of sending them cheesy without somehow resending the data associated with wheezy?

推荐答案

Docker save目前不具备复制部分映像的功能.保存和加载的最初设计目标是在气隙系统之间传输图像及其所有相关性.(来源:我是保存和加载的最初作者)

Docker save does not have the capability to copy partial images at this time. The initial design goal of save and load was to transfer images and all its dependencies between air gaped systems. (source: I am the initial author of save and load)

问题在于,尽管您可能拥有debian:wheezy,但如何确保每个系统之间具有相同的debian:wheezy?成功保存和加载的唯一肯定方法是序列化整个树.

The problem is that while you may have debian:wheezy, how can you be sure that you have the same debian:wheezy between each system? The only sure way to have a successful save and load is to serialize the entire tree.

相反,您应该考虑运行私有Docker注册表.您可以发布myorg:cheesy并让docker pull和docker push解决所有依赖关系.这也将降低您的整体带宽使用量,因为只会传输您尚未拥有的层.从长远来看,它也将使您更容易管理.

Instead, you should consider running a private docker registry. You can publish myorg:cheesy and let docker pull and docker push work out all the dependencies. This will also lower your overall bandwidth usage since only the layers you don't already have will be transmitted. It will also be much easier for you to manage in the long run.

要运行自己的私有注册表,您应该签出 https://github.com/docker/distribution,这是一个开放源代码的私人仓库.如果您需要开发人员的帮助,则可以跳到freenode的#docker-distribution.

To run your own private registry, you should check out https://github.com/docker/distribution which is an open source private repo. You can hop onto freenode's #docker-distribution if you need help from the developers.

这篇关于是否有使用Docker的聪明方法(也许通过save/load/diff)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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