When a bottle is left out in summer for sometime gas bubbles are formed on its walls and they remain there unless they are disturbed. But why does it happen so? I mean the water is exerting buoyant force on the bubbles and yet they remain stuck to the bottle. Here is an image for reference
Three factors come into play here. One is that the solubility of gases in water tends to decrease with increased temperature and with decreased pressure. This is why it's a bad idea to open a warm soda bottle. Cool it first. This is also the case for nitrogen and oxygen, the main constituents of the atmosphere), and also chlorine, which is widely used to disinfect public water supplies.
The second factor is nucleation sites. The dissolved air will have a much rougher time coming out of solution if the surface of the bottle is very clean and smooth. Most bottles are not clean and smooth at the molecular level. The nucleation sites provide locations at which the dissolved gases are much more likely to come out of solution.
The third factor is water's rather high surface tension. It is energetically more favorable for a small bubble to stick to the wall with part of the bubble's surface area not surrounded by water than it would be for the bubble to break free and be completely surrounded by water. The non-spherical shape of bubbles stuck to the wall makes sufficiently large bubbles be at an energy disadvantage should they remain pinned to the wall.