Edward Teller once described the problem of containment of a plasma by magnetic fields as being like trying to contain Jello with rubber bands. This problem in this question is just like the problem of magnetic confinement of plasma for fusion energy.
In the late 1950's there was a brief scientific thaw in the Cold War, and a conference was held which brought together western and Soviet scientists to discuss magnetic confinement fusion. The innovation that the Soviets introduced to the west then was a magnetic 'bottle' called a Tokamak. This design was special.
The trick of a container is that it must not actually touch the hot plasma, which is often millions of degrees in temperature. Plasma is about as wriggly as can possibly be imagined, and will leak out from any magnetic container, if the plasma is hot enough. Particularly, putting more energy into a plasma seems always to make available to the plasma new instabilities -- new ways of wriggling out of whatever is holding it.
The doughnut-shaped tokamak was able to prevent certain instabilities, by having a magnetic field around the main ring of the doughnut ('toroidal' field), and adding another field which wrapped into the ring, through and around it ('poloidal' field). The net magnetic field thereby circled the main part of the torus, but had an extra twist, or wrapping around the small dimension, added into it. This prevented a difficult way in which the plasma wriggled; it contained that instability.
An inside view of a Tokamak magnetic confinement fusion device.
An inside view of a tokamak magnetic confinement fusion device.
The magnetically confined plasma held by a tokamak as the one above.