As I see it, it could work in a glass bottle that wasn’t strong enough to contain the pressure of the C02 as the solid changed into a gas. That would depend on how much dry ice was used, the size and strength of the container, and the ambient temperature.
When I first started brewing beer, I had a few CO2 bombs explode in my closet while I was sleeping. I lived in Saudi Arabia at the time and, in my slumber, the breaking glass made me think somebody had thrown a dud grenade through my window. After a few more explosions shortly later, I smelled the beer that sprayed in my closet. The explosions caused no damage at all (except to my precious beer) but made a mess.
There is no physical reason why a dry ice bomb in a glass or plastic vessel would be any more potent. Pressure builds until the vessel fails and then there’s a rapid dispersion of CO2. A pressure vessel may be a make a bigger explosion with dry ice, but I doubt that it would be remotely comparable to a gunpowder explosion.