The short answer is yes, but only with the right bamboo and a properly built planter. Bamboo spreads mainly through underground rhizomes, not seeds, so containment is about controlling those roots. Clumping bamboo grows in tight clusters and is much less likely to escape an urban planter box than running bamboo. Running bamboo sends long rhizomes sideways and can travel through drainage holes, seams, cracks, or over the rim, so it is risky unless the planter is designed like a genuine root barrier.
For an urban planter box, clumping bamboo is usually the safer choice. If you want running bamboo, the box needs strong walls, no gaps, protected drainage holes, and a bottom or liner that rhizomes cannot penetrate. A decorative wooden box by itself is often not enough. The planter should also be deep and wide enough for the bamboo, with good drainage and healthy soil. Place it on a hard surface or with a root barrier underneath, and cover drainage holes with fine metal mesh.
Maintenance matters. Check the rim, base, and drainage points each spring, and prune any rhizomes that appear. Also check local rules, because some running bamboos are restricted. In short, you can grow bamboo in an urban planter box without it spreading only if you use clumping bamboo or a truly root-proof planter, maintain it carefully, and remember that no container is foolproof if it is poorly built or neglected.