Docker Community Forums

Share and learn in the Docker community.

Linking a single image to multiple images via BUILD

(Sgibney) #1

Hi all,
Im new to this so apologies if this is a newbee question.

I have an image that contains a set of binaries appropriately installed (quite large). My next step is to do some configuration from these binaries, but I want to do the configuration via build but link into the base binaries. I can do it on the command line with docker run using volumes-from, but I want to have some lightweight images that depend on the binary install but dont duplicate it (avoid the bloat). Is this a good fit for docker, and if so how can I go about it in the Dockerfile ?


(Andy Rothfusz) #2

Would your users already have the binary install image? If so, then your lightweight images that depend on it would stay lightweight. The binary install image would be the “parent” to the lightweight images, so it would not be copied. One read-only version of it would be re-used (referenced) by each read-only lightweight image. When you docker run, the Docker Engine will add a writable layer to the top of the stack, for use by the Container you’ve created from the images.

(Sgibney) #3

Thanks Andy, what Im trying to achieve is 1 base image which is large (e.g. centos + product installation) and then on top one (or many) small images with configuration which are then instantiated with docker run. Im trying to work out the sensible/accepted/correct way to link the multiple small configuration images back to the single large binary install image so that I can distribute only one large image and then a simple config docker build for people to run. Do you have any thoughts on the best way to achieve that ?