D meson production in proton–lead (p+Pb) collisions is globally investigated within the color dipole framework. To simplify the Fourier transform, the analytical transverse momentum distribution functions extracted from different color dipole models are used. With the Glauber–Gribov method, the impact parameter dependence is considered for the nuclear modification of the gluon density. We obtain from comparison with recent experimental data from the LHCb and ALICE Collaborations that the theoretical results from the Kovchegov, Lu and Rezaeian (KLR) model are in good agreement with the experimental data at small P T, and the results from the Golec–Biernat–Wüsthoff (GBW) and Bartels, Golec-Biernat and Kowalski (BGK) model are reasonable at all rapidity bins. Then, the influence of the initial-state energy loss effect on D meson production in p+Pb collisions is analyzed. A clear reduction of the nuclear modification factor is shown at backward rapidity. Finally, the predictive results for D0 and D+ production differential cross section versus rapidity (Y) in p+Pb collisions are given.