Why do air bubbles cling to the walls of a vessel when water is heated?

When water is heated, steam bubbles out. Apart from the energy required to heat up to the boiling point (about 100 °C) and the latent heat, additional energy is required (due to surface tension) to form the bubbles since they have a free surface.Pressure inside a bubble is higher than that in the surroundings by an amount 2 T/R, where T is the surface tension coefficient and R is the radius of the bubble. If R is very small this additional pressure can be very large. Hence the bubbles are usually formed where the hot vessel surface is rough and has crevices. 

One can observe boiling water on a stove where the steam bubbles rise from a rough horizontal surface of the vessel. When the bubbles rise due to buoyancy they grow in size and when they are located over the water surface they are formed by a film and have two free surfaces an inside one and an outside one. Additional pressure inside the bubble is then given by (4 T/R) due to two surfaces. Interesting things happen here. This liquid film is fragile and can easily break unless it is made up of milk or oil or soap water. When a bubble comes close to another bubble or an object it gets attracted and clings to it because of surface tension. We can see bubbles clustering on the free surface of coffee. The bubbles in the interior of the water body cling to the wall and have the shape of a truncated sphere. To detach them, there is a need to increase their surface area, which needs additional work. Thus they stick to the wall because of surface tension, resisting buoyancy force or any other disturbance. Since they do not have a film they do not break.Such bubbles can be a great nuisance in a water flow experiment when observations are to be made through a glass window, for example, by shining a laser beam. Bubbles arising from the dissolved air and sticking to the glass window cannot easily be removed even by increasing the water flow rate. They need internal mechanical wiping.

Source: thehindu.com