Growing onions in pots or containers is very similar to growing onions in the ground. You need good soil with sufficient drainage, lots of water and sunlight, and a good fertilizer. Aside from those few essentials, you will need to select a container that provides sufficient space to grow the amount of onions that you want to cultivate.
You will need to select a container that is at least 10 inches deep and several feet wide so that you can plant enough onions to make it worth your time. Using a plastic tub is a cheap container idea that provides plenty of space, just be sure to drill drainage holes in the bottom of it so that water can escape easily. 5 gallon buckets are another decent container solution as long as you use several, as each bucket will only be able to grow three or four onions due to the surface area available.
Once you have a container or two ready to grow your onions in, be sure to pick a location that gets six to seven hours of direct sunlight per day to place your onion pots in, as onions need as much sunlight as they can get. Onions grown in containers will need more water than onions grown in the ground, as container onions will have little access to naturally stored rainwater like onions grown in the ground do.
Therefore, you will need to provide two to three inches of water per week, maybe even more in hot weather conditions. Check the soil in your onion containers daily, and provide water anytime the topsoil is dry to the touch. Aside from these few differences, container grown onions need the same care that onions grown in the ground require.