We solve the relativistic equation for a hydrogenlike ion located at the center of a spherical cavity. Relativistic effects are determined as a function of atomic number. A few interesting properties such as level crossing and energy plateaus are discussed.