Polaron and bipolaron formation in the Holstein-Hubbard model with harmonic confinement potential, relevant to quantum dot structures, is investigated in one to three dimensions by means of unbiased quantum Monte Carlo simulations. The discrete nature of the lattice and quantum phonon effects are fully taken into account. The dependence on phonon frequency, Coulomb repulsion, confinement strength (dot size) and electron-phonon interaction strength is studied over a wide range of parameter values. Confinement is found to reduce the size of (bi-)polarons at a given coupling strength, to reduce the critical coupling for small-(bi-)polaron formation, to increase the polaron binding energy, and to be more important in lower dimensions. The present method also permits to consider models with dispersive phonons, anharmonic confinement, or long-range interactions.