Jesus, that was incredibly lucky.
I have some of these and some of these. I want to store each battery in its own bag, so they at least have a chance to not all ignite in a domino effect.
If you want to be even more careful, you can also put sand into a plastic bag and put it on top of those bags in the ammo can. In case of fire, the plastic bag melts and the sand quenches the fire. Oh, and smoke detectors where you store them.