Using 1D and 2D particle-in-cell (PIC) simulations of a plasma with a growing magnetic field B, we show that ions can be stochastically accelerated by the ion-cyclotron (IC) instability. As B grows, an ion pressure anisotropy p ⊥,i > p ||,i arises, due to the adiabatic invariance of the ion magnetic moment (p ||,i and p ⊥,i are the ion pressures parallel and perpendicular to B). When initially β i = 0.5 (β i ≡ 8πp i /|B| 2 , where p i is the ion isotropic pressure), the pressure anisotropy is limited mainly by inelastic pitch-angle scattering provided by the IC instability, which in turn produces a non-thermal tail in the ion energy spectrum. After B is amplified by a factor ∼ 2.7, this tail can be approximated as a power-law of index ∼ 3.4 plus two non-thermal bumps, and accounts for 2 − 3% of the ions and ∼ 18% of their kinetic energy. On the contrary, when initially β i = 2, the ion scattering is dominated by the mirror instability and the acceleration is suppressed. This implies that efficient ion acceleration requires that initially β i 1. Although we focus on cases where B is amplified by plasma shear, we check that the acceleration occurs similarly if B grows due to plasma compression. Our results are valid in a sub-relativistic regime where the ion thermal energy is ∼ 10% of the ion rest mass energy. This acceleration process can thus be relevant in the inner region of low-luminosity accretion flows around black holes.