Geometrically incompatible confinement of solids