There is no rule saying the container has to break. All freezing water does is increase the pressure inside the container. Higher pressure may cause a different type of ice crystal to form.
So the answer is that the water still turns into ice; however, if it genuinely cannot break the bonds of the container it is trapped inside, it turns into a very different kind of ice than we’re used to seeing.
We currently know of 15 different solid phases of water, aka ice, with each type being distinct due to differing density and internal structure. The form you’re likely most familiar with is Hexagonal Ice which is what happens when water freezes normally under regular conditions. If you keep lowering the temperature of Hexagonal ice, it eventually becomes Cubic Ice; tweak the temperature and pressure further and you can create more kinds — Ice II, Ice III all the way up to Ice XV.