We introduce a one-dimensional model of a cavity with the Kerr nonlinearity and saturated gain, designed so as to keep solitons in the state of shuttle motion. The solitons are always unstable in the cavity bounded by the usual potential barriers, due to accumulation of noise generated by the linear gain. Complete stabilization of the shuttling soliton is achieved if the linear barrier potentials are replaced by nonlinear ones, which trap the soliton, being transparent to the radiation. The removal of the noise from the cavity is additionally facilitated by an external ramp potential. The stable dynamical regimes are found numerically, and their basic properties are explained analytically.