The answer is yes, but only if you have an extremely large container! The smallest varieties of "dwarf" forms grow 8-12 feet tall and 6-8 feet wide at full maturity. Most of the smaller types grow into a multistemmed shrub rather than a single-trunk tree, though you could train them into a tree form.
The good news is that they are slow growing, and 'Little Gem', for example, a type of southern magnolia (Magnolia grandiflora), will take 20 years to reach 20 feet. Others to consider include star magnolia (M. stellata). 'Royal Star' is a superior selection with pink buds that open white. Magnolia X 'Ann' has late-blooming purplish-red blooms. 'Waterlily' has fragrant white flowers. Henry Hicks sweet bay magnolia (M. virginiana 'Henry Hicks') is the hardiest of the sweet bays (to Zone 5). It develops lemon-scented creamy white blooms in late spring to early summer.
To help container-grown magnolias survive, it's important to use a potting mix that contains lots of organic matter (see the potting mix package for a list of ingredients). Also, be sure to feed the tree monthly during the growing season with half-strength liquid fertilizer. Avoid fertilizing after late summer. Because the tree roots cannot search outside the pot for soil moisture, be sure to water regularly, and make sure your pot has sufficient drainage holes to prevent water from accumulating in the pot. Magnolias like cool roots, so keep a layer of mulch on the soil's surface. In cold-winter regions, protect the roots from severe freezing weather; keep the container in an unheated garage or cover it with a thick layer of mulch.