合并两个 docker 镜像 [英] Merge two docker images

查看:121
本文介绍了合并两个 docker 镜像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用 docker 来建立一些生物信息学分析.

I'm hoping to use docker to set up some bioinformatic analysis.

我找到了两个我想使用的 docker 镜像:

I have found two docker images that I would like to use:

  1. jupyter/datascience-notebook
  2. bioconductor/devel_base

我已经成功地独立运行了这些图像中的每一个,但是我不知道如何将它们合并在一起.

I have been successful in running each of these images independently, however I don't know how to merge them together.

是否可以合并两个 docker 容器?还是从一个开始,然后手动安装另一个的功能?

Is merging two docker containers possible? Or do you start with one, and then manually install the features of the other?

推荐答案

你不能只合并图像.您必须根据您想要的每个图像中的内容重新创建自己的.您可以像这样下载这两个图像并为每个图像重新创建 Docker 文件:

You can't just merge the images. You have to recreate your own based on what was in each of the images you want. You can download both images and re-create the Docker files for each like this:

docker history --no-trunc=true image1 > image1-dockerfile
docker history --no-trunc=true image2 > image2-dockerfile

将 image1 和 image2 替换为您要查看其历史记录的图像.在此之后,您可以使用这些 dockerfile 来构建您自己的镜像,这是两者的结合.

Substitute the image1 and image2 with the images you want to see the history for. After this you can use those dockerfiles to build your own image that is the combination of the two.

美中不足的是,任何 ADD 或 COPY 命令都不会显示复制的内容,因为您无权访问创建原始图像的本地文件系统.运气好的话是不必要的,或者您可以从图像本身中找到任何丢失的部分.

The fly in the ointment here is that any ADD or COPY commands will not reveal what was copied because you don't have access to the local file system from which the original images were created. With any luck that won't be necessary or you can get any missing bits from the images themselves.

这篇关于合并两个 docker 镜像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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