We make these every year at 4th of July..
Take a 2 liter bottle, break up some dry-ice and put it in said bottle (about a half-a-cup works), then pour some water in - about 2 cups - then QUICKLY cap the bottle (screw top) and RUN AWAY. They blow in a couple of minutes - but occasionally the blow VERY quickly. Big BOOOM. No fiery explosions.. Good times to be had by all..
But the physics works the way you described. The CO2 expands and pushes out on the walls of the bottle until the bottle can no longer maintain the volume of the rapidly expanding gas.