In this paper, we study the spontaneous scalarization of Reissner–Nordström (RN) black holes enclosed by a cavity in an Einstein–Maxwell-scalar (EMS) model with non-minimal couplings between the scalar and Maxwell fields. In this model, scalar-free RN black holes in a cavity may induce scalarized black holes due to the presence of a tachyonic instability of the scalar field near the event horizon. We calculate numerically the black hole solutions, and investigate the domain of existence, perturbative stability against spherical perturbations and phase structure. The scalarized solutions are always thermodynamically preferred over RN black holes in a cavity. In addition, a reentrant phase transition, composed of a zeroth-order phase transition and a second-order one, occurs for large enough electric charge Q.