从单独的Docker图像中组合可执行文件?

发布于 2025-02-10 18:01:11 字数 572 浏览 2 评论 0原文

假设我需要a.exeb.exe我的最终 node 按运行时图像。 a.exeb.exe恰好在Docker Hub上可用,但它们来自单独的图像。 Docker是否有办法以某种方式从我的最终图像中可用的不同图像中制作同时可执行文件?

我认为Docker的多阶段构建并不重要,因为它仅简化了我们希望在下一个图像上可用的 trafacts 。而在我的情况下,我需要以前图像的整个运行时环境。我可以选择 run run shell命令手动安装这些依赖性,但这确实是唯一的方法吗?

Let's say I need A.exe and B.exe installed in my final node image by runtime. Both A.exe and B.exe happen to be available on Docker Hub, but they're from separate images. Does Docker have a way to somehow make both executables from different images available in my final image?

I don't think Docker's multi-stage build is relevant as it only simplifies passing artefacts that we want available on the next image. Whereas in my case, I need the whole runtime environment from previous images to be available. I have the option to RUN shell commands to manually install these dependencies but is this really the only way?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情未る 2025-02-17 18:01:11

您可以使用多阶段构建,因为您可以声明a。 EXE/B.EXE以及所需的运行时是所需的人工制品。

但是我同意,如果您从软件包中安装运行时,只需复制应用程序即可。

You could use a multistage build, since you could declare a.exe/b.exe together with the required runtime to be the required artefacts.

But I agree it could be easier if you install the runtime from packages and just copy the application.

删除会话 2025-02-17 18:01:11

如果您对所需的需求有所肯定,则可以 export 图像图像a>和图像B作为焦油球。

现在是棘手的部分:合并两个文件系统结构
提取两个档案,使您拥有一个目标文件系统结构,然后将其再次包裹在焦油球中。

因此,获取文件并非不可能 - 但是您需要确切知道自己在做什么。

最后, import tar ball to docker映像。

If you feel sure enough about what you need, you could export image A and image B as tar balls.

Now comes the tricky part: merging the two filesystem structures
Extract both archives such that you have one target filesystem structure and wrap that up into a tar ball again.

So it is not impossible to get the files - but you need to know exactly what you are doing.

Finally import that tar ball into a docker image.

获得组合图像的一种选项不是合并两个图像,而是合并两个Dockerfiles。这可能偶尔需要审查,但甚至可能比图像本身的变化频率少。

One option to get a combined image is not to merge two images but maybe merge two dockerfiles. This may need a review once in a while but might even change less often than the images themselves.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文