When the atoms in the pre-planet-particle form molecules, rapidly changing into a compact sphere, some of the atoms are left behind. They form light gases of different elements in a large shell around the compact rocky sphere. Then when the ice layer forms, it traps the gases and a lot of steam between the ice layer and the surface of the rocky body. The atoms outside of the ice layer drift off and later get scrubbed by the solar winds.
The steam eventually cools down and condenses into water that collects in depressions on the surface of the rocky sphere.
The gases form an atmosphere for the planet.
For example, consider Mars. Its ice layer was eroded by the solar winds since it did not have a protective magnetosphere. However, part of its atmosphere still remains, as pictured above, and contains water-ice clouds. Also, the exploration of Mars has revealed that it had water on its surface in the past. It most likely still has water in its Moho-like layer between the crust and mantle.