我如何将几个图像合并为一个?

我有几个图像(第三方),例如设置一个MySQL,build立一个通用的PHP应用程序环境,build立第三方工具。

我想制作一个Dockerfile / Docker Image,将这两个图像结合起来,然后运行一些命令

imageA -- \ imageV -- ---> sharedImageA..X / imageX -- 

你可以链接他们。 你可以在这里find更多

https://github.com/docker/docker/issues/3378#issuecomment-31314906

从上面的链接采取

 ## Dockerfile.genericwebapp might have FROM ubuntu cat Dockerfile.genericwebapp | docker build -t genericwebapp - ## Dockerfile.genericpython-web would have FROM genericwebapp cat Dockerfile.genericpython-web | docker build -t genericpython-web - ## and then this specific app i'm testing might have a docker file that containers FROM genericpython-web docker build -t thisapp . 

上面的 SvenDowideit的 作者

一般来说,在同一个容器上运行多个进程是不好的做法。

由于从秒和第三个图像的依赖关系可能会冲突从第一个图像的依赖关系,我不认为docker将能够支持它。

我想唯一的select是从其中一个开始你的形象,然后安装/运行其他2个步骤的所有步骤:

 FROM imageA RUN .... commands for imageV RUN .... commands for imageX