Create a docker image

Hi ,
I want to create a 3 hadoop and spack docker images in ubuntu ,in that one should work as a master and another 2 work as a slaves,i’m new to this docker so could anyone explane me how to create .

Thanks