Docker implement structure

Hi all,

I am new in docker and using docker to build and run images for a while, and I basically write some c++ binary and make a docker image contains this binary executable file.

It is working well, but with program becomes more and more complicated, it is not a good idea to write them into a same image ( just like it is not good idea to write all code in a single ‘int main()’.cpp file), it will be not easy to maintain.

So I am thinking, it is possible for docker to build lots of separated images which are in charge of different functionalities.

For example, I am doing k-mean cluster for a dataset, before that there is a data normalization to normalize dataset first.
Then I have another one may be SVM which also require data normalization first, of course I can do reuse a same normalization as header.h in here, and make .exe and then building docker image, but every time I have to add those customized header.

It is possible to do like build a common data normalization docker image (A), and every time when a new program (B) is made and requires this existed docker image (A) (e.g. “FROM normalize:lasted (A)”), use this data normalization (A) output as that new image (B) input.

Is there some doc related? Any help and suggestion appreciated!