Why does freezing water break glass-even when there room for it to expand?

I have noticed that sometimes when water is put into the freezer in a glass bottle or open container, the glass will break as the water freezes–even though there is plenty of room for it to expand. It’s as if the water chooses to expand outward–against the glass walls–instead of into the free space.