Much of the problem We have in understanding the nature of matter/energy equivalence and QM is because it is the difficulty of trying to describe exactly a concept that is both counter intuitive and using the symbolic (language) that falls short.
The question as stated -
Does energy contain mass?
-... is not really the question.
If you want to be syntactically and pedantically correct the answer is no. Energy does not “contain “ mass, not like a chemical suspension or solution, rather energy is equivalent to a given mass . STR states that energy and mass are equivalent. They are different forms of the same thing.
When Physicists perform an experiment in a particle accelerator, mass is measured in terms of energy I.E. MEV, BEV – Millions/Billions of Electron Volts. That is the reality of Einstein's equation.
Secondly, the photon is not the best foothold to try and grasp the idea of gravity. The photon even in the strange world of QM has peculiar properties, here comes the monkey wrench. QM describes a photon is timeless and spaceless, meaning that the quanta is traveling at c, it has no rest mass as stated and ( heres the kicker) exists everywhere at once.
As Dr.NK stated there are two incompatible theories, of gravity GTR and Quantum gravity GTR is generally understood ,QG is being fleshed out but the problem is that there appears to be no point of agreement. Both theories work extremaly well to a certain point and then break down That is one reason that string theory is a promising area of study now, it appears to reconcile the differences between the Relativistic and the QM models of gravity.
I would study point particles to gain an understanding of the energy/mass question rather then photons.
Very good text here
http://relativity.livingreviews.org/Articles/lrr-2004-6/download/lrr-2004-6Color.pdf