Yes light can exert a gravitational force but the light system must have a zero momentum frame.
In other words (and simplified) a photon or photons all moving in the same direction have no mass, but a system of two photons moving in opposite directions does have mass.
If a sufficiently energetic sphere of photons were heading towards and centered on the Earth we could be inside a black hole right now and not even know it.
ETA assuming the sphere of light was inside it’s Swartzchild’s radius