If you have large containers (at least 4-5 feet in diameter), you can grow apples in pots. Choose dwarf varieties, which won't become too large for the containers. Fill the pots with a high-quality potting mix. It's best not to use garden soil as it doesn't drain well in containers.
In Zone 6 and warmer, you can leave the pots outdoors all year. But in colder climates it's best to move the trees to a more protected spot, such as an unheated garage or storage shed for the winter.
It's important to keep container-grown apple trees watered well. You'll also want to fertilize your apples with a general-purpose timed-release plant food each spring to ensure the tree has enough nutrients to bear a healthy crop of apples.