Volcanic eruptions are formed when so much PRESSURE from the magma inside the volcano builds up to it's boiling point.
An example would be like shaking soda as soon as the pressure is released there is foam. It's then same concept but with magma aka lava
Hope this helped