If only your second coat of paint bubbled, but the first coat did not, then you can eliminate one possible cause of the bubbles: substrate moisture. If the humidity on the other side of the substrate, such as the siding around an attic, is high, it can permeate the substrate and cause bubbling. This may occur at any time, but will cause all the layers of paint to bubble rather than just the top layer. Wicking, or when water travels through wood, can also cause multiple layers of paint to bubble.
The most likely reason that your second coat of paint bubbled was that the first coat did not have time to dry properly. Paint cans list a "recoat time," which is the amount of time the paint needs to dry before a second layer of paint can be painted over it. As paint dries, moisture in it evaporates. If you paint too soon, the moisture gets trapped. As it evaporates, pressure builds up and causes bubbles. Humidity levels above 50 percent will slow down the drying time and may require you to wait longer than the listed recoat time.
Moisture can still be a problem, even if you waited far longer than the recommended recoat times. In this case, the moisture didn't come from the paint — it came from the environment. Dew, humidity and rain can all make an exterior surface moist. Painting a surface that is too wet with oil-based paint is likely to cause bubbling. Latex paint is more likely to bubble if the substrate is exposed to moisture after it is painted.
Sunlight and fresh paint do not mix. The sun causes the surface of the paint to dry too fast, so it dries before the rest of the paint does. As the rest of the paint dries, the moisture can't evaporate because of the dry paint barrier. The air vapor builds up and causes bubbles. Adding paint conditioners can help slow down drying times, but it is much better to paint when the surface is not in direct sunlight or will not be in direct sunlight for several hours.