Confinement effects on the ground-state energy of many-electron atoms located inside a penetrable prolate spheroidal cavity are studied within a variational treatment of the Thomas–Fermi–Dirac–Weizsacker density functional scheme. Given a confining cavity size and shape as well as barrier height, isotropic and anisotropic confinement effects on the energy evolution, ionization potentials and pressure are discussed as well as their different conditions for electron escape. Comparison of the spheroidal box results for the energy evolution with corresponding ab initio calculations for endohedral confinement of Ne within the supermolecule approach $$\hbox {Ne@}\hbox {Ne}_{\mathrm {10}}$$ ( $$\hbox {He}_{\mathrm {10}})$$ suggests that reasonable agreement between both types of calculation is achieved provided the atom-in-a-box model incorporates the mean size of surrounding atoms with nuclei positioned at the spheroidal baseline of the cavity and a realistic choice of the mean confining barrier height.