According to this thread,
dragons would have have special bacteria that produces methane, which is stored in a large gas bladder. Because of the large volume of methane they store, they are able to fly easier. They’d also release the methane through their mouths which they’d ignite somehow. So basically whenever they breathe fire they’d be sacrificing their ability to fly until they produce more methane.
Also,
they eat pieces of metal and it gets stuck in their gizzard and when they release methane they grind the pieces of metal together causing a spark which ignites the gas.
(both by Atrox, who doesn’t have an account on this forum)
So they need certain metals in order to ignite their flames, but just collect all shiny things they see
(by @Aquos )