When water is boiled in an iron container, all the air in the container heats up and becomes lighter and rises upwards. In this way all the air in the box goes out. On further heating, the boiling water turns into steam and the can is filled with water. Covering the vessel with a lid ensures that the vapours are trapped inside the container. This reduces the air pressure inside the box compared to the outside air. In this way on pouring cold water the outside air pressure causes the box to shrink inwards.