Fireworks powder is basically black powder. It is designed to go boom all at once and therefore is best suited for bombs. Modern gunpowder explodes in a more controlled fashion, in addition to being smokeless, and is much more tunable for sending a bullet down the barrel.
Depends on the fireworks. They use all kinds of different materials to get the colorful effects.
If you put gunpowder in a closed container the effect won’t be significantly different then blackpowder. At least not at the small scale.