  Recently, the phase space of black holes in a spherical cavity of radius
$r_{B}$ has been extended by introducing a thermodynamic volume $V\equiv4\pi
r_{B}^{3}/3$. In the extended phase space, we consider the thermodynamic
geometry, which provides a powerful tool to understand the microscopic
structure of black holes, of Reissner-Nordstr\"{o}m (RN) black holes in a
cavity, as well as that of Reissner-Nordstr\"{o}m-AdS black holes. Although the
phase structures of the cavity and AdS cases show striking resemblance, we find
that there exist significant differences between the thermodynamic geometries
of these two cases. In particular, a reentrant transition of the type of the
microstructure interactions, i.e., repulsive $\rightarrow$ attractive
$\rightarrow$ repulsive with increasing temperature in an isobaric process, is
observed for RN black holes in a cavity.
