Optical properties of the lead halide perovskite nanocrystals are controlled by confined excitons and a rich spectrum of confined acoustic and optical phonons. We study experimentally and theoretically the exciton-phonon interaction in CsPbI3 perovskite nanocrystals embedded in a glass matrix. Energies of phonon modes allowed by selection rules are detected by resonant Raman scattering for nanocrystals with sizes of 4-13 nm, covering exciton energies of 1.72-2.25 eV. While optical phonon energies remain size-independent, the energies of confined acoustic phonons increase in smaller nanocrystals. Acoustic phonons are modeled within the continuum approximation by using elastic constants computed by density functional theory. The model provides the energy spectra of confined phonons for nanocrystals with cubic, spherical, and spheroidal shapes, orthorhombic and tetragonal symmetries, and different sizes. Exciton confinement restricts efficient coupling to a few phonon modes observable in Raman spectra. By comparing experimental data with model predictions, we conclude that the nanocrystals predominantly have spherical or spheroidal shapes.