Duplication among Dockerfiles

Hello everyone!
I am installing OpenStack Keystone now.
For standalone Keystone needs three components: mysql, python, and apache2.

Absolutely I can’t pick all of them to the base, I made python as a base image, and others were inserted as RUN statements for installing mysql and apache2.

I think that the RUN statements are duplication because all the three components exist on Docker Public Registry.

Is there any good solution or proper way to reuse the existing external Dockerfile???

1 Like

Up. I have the same question. I am beginning in the docker world and can’t understand why the 70 lines long bullseye dockerfile for a particular image is exactly the same as the stretch image except for the FROM line. This means we have 69 lines of instructions that are duplciated between the two files, and that’s ok ?

Wouldn’t it be better if the FROM instruction can be given as a command line argument to docker build ? that would allow a single Dockerfile for different versions of a distro. See for example these two nearly identical docker files for nodejs, one for buster and for bullseye. They only differ in the FROM line. 69 lines duplicated.