You have re-discovered bonsai. Bonsai means grown in a container. It is literally "tray cultivation." Though it covers many types of containers other than trays.
A small container will have a big effect on tree growth.
A small container is not the whole story by any means. In order for a tree to be healthy it must be growing. When we grow trees in containers there are bunches of things we do. One big one is pruning. This involves shaping the tree to the restrictions of the container as well as shaping the tree in desirable fashion. That is, you prune both the visible parts of the tree and the roots.
There are lots of other things like controlling fertilizer, water, and light levels.
Some species of tree will do better in containers than others. Some will thrive when pruned back and shaped, others will not do well. Oak trees are notorious for going along fine for years then just dying for no apparent reason. There are varieties of many types of tree that tend to be smaller and so are easier to raise in a pot. I had a dwarf spruce tree for many years until I made the mistake of trusting it to a friend's care while on vacation.
Pine and maple are extremely popular, but there are many species that are grown.
Your strategy should depend on the specific type of tree you have, and the general size you are interested in. Bonsai come in a large range of sizes from tiny little things that you could hold in your hand up to massive things in pots that are meters wide. And the methods that work for one type of tree are going to fail miserably for other types. For example, some types of trees really don't tolerate being pruned. While others are not really healthy and vibrant unless they are pruned.
Google up the specific type of tree you have and look for the care guidance appropriate to it. If you can possibly find it, get the specific variety of tree.