If you don’t have the space for a vegetable garden, a viable solution is growing vegetables in containers. As long as you have sun, such as near a south-facing window or on a patio or balcony, you can have the same success as other gardeners growing vegetables like tomatoes, green beans, green onions and squash. You may not be able to grow them in large quantities, but you'll still be able to enjoy fresh, homegrown vegetables.
Choose containers such as plastic plant pots, milk jugs or ice cream tubs that are large enough to accommodate the vegetable plants and roots. Texas A&M University recommends 1-gallon containers for leaf lettuce, cucumbers and green onions, 2-gallon containers for broccoli, green beans and turnips and 5-gallon containers for peppers, eggplant and tomatoes.
Drill three or four holes in the bottom of the container with a 1/4-inch drill bit if it doesn't already have them. Lay 1 inch of coarse gravel or rocks at the bottom of the container. You will not have a good harvest unless your soil has the ability to drain water.
Fill the container within an inch or two of the rim with all-purpose potting soil or with a soilless growing medium. Both work well when growing vegetables in plastic containers. Some have fertilizer already mixed in so you don't have to fertilize at planting time.
Water the soil so it is already moist when you plant your vegetables. Stop when you see water coming out of the drainage holes. The soil should be slightly moist when you dig your hands in.
Plant nursery stock plants or plants started in seed trays in the plastic containers to the same depth as they were planted before. Vegetables such as tomatoes and squash should be planted one per container; plants such as leaf lettuce and carrots should be two or three per container. Even container space out for multiple plants.
Place your containers in the sun and keep the soil moist. Add fertilizer if necessary. If your potting medium has a slow release fertilizer, you may not need to water until the plant is actively growing. When you do fertilize, following the dosing instructions carefully and water afterward.