When talking about containers for trees it requires a half barrel to get the longest life out of a fruit tree.
Pots and containers tend to let the water run straight through before it has a chance to soak into the soil, so drippers do well on half barrels and large containers, 5 gallons per hour, left on for an hour, once or twice a week in a dry spell. If it rains, there needs to be a minimum of 4 to 5 gallons of water soaking into a half barrel. It can be surprising that even a heavy downpour may not produce that much water over the barrel surface
Potting soil from a bag is very sterile and won't have the soil bacteria a healthy tree needs. Mixing 2/3 soil-1/3 bag of
compost, some leaving at least 4 inches of the top of the barrel empty so you can add more compost during the spring and summer, organic mulch such as mowed weeds or leaves, 3" deep, over the top of that, some rock powders for minerals, then composted manure in the late fall/early winter or organic fertilizer from a bag. If it is given high-nitrogen fertilizer in the spring it will drop most of its blossoms and start growing, which you want fruit formation in the spring/summer.
This is different from planting a tree in the soil. If there is compost in the hole in the ground the roots will circle and cause growth problems. In a container they are going to circle anyway, and are heavily relying on the small amount of soil around them for nutrients, so it needs to be there. They can't reach out for more water and nutrients.
The root system of a tree is almost a mirror image below the soil of what it looks like above ground, but a half barrel will change that, so extra care has to be taken. Watering needs to be very, very consistent, the soil needs to be consistently damp, not wet. If you go on vacation containers will need consistent watering. It's easy to spend 5 years carefully tending a large plant in a container, then one or two weeks of inconsistent care can send it into a downward spiral.
There will be some fruit forming on a young tree, which would ordinarily be picked off so that the tree can put all its energy into roots in the ground. But in a barrel that isn't as important after about year 2, depending on the age of the tree you start with. It's also important to see if fruit starts to form on the tree so that you know you've got pollination. If you live in a neighborhood with other apple trees that may be all that's needed.