We used Langevin Dynamics Simulations to study compression and relaxation processes of confined ring polymers in a nanochannel by a sliding piston. Our findings show that ring polymers undergo a series of complex deformations in compression, dependent on the degree of confinement and the topological constrains: the weakly confined flexible ring is compressed into the condensed blobs, while the strongly confined semiflexible ring undergoes deformations from double helix to collapsed states, in order to reduce the bending energy. In the relaxation process, with the piston drawing back, the weakly confined ring relaxs to the initial states, while the strongly confined ring extends from the compacted states to the randomly folded states, due to the interpenetrated and self-entangled structures formed in the compression process. These findings are important to understand the complex deformations and relaxation of ring polymers in mechanical compression or driven transport arising from the geometric confinement.