1852, "a rocking chair," American English, agent noun from rock (v.1). Middle English had rokker, "nurse charged with rocking a cradle" (early 14c.). In sense of "one of the curved pieces of wood that makes a chair or cradle rock" it dates from 1787. Meaning "one who enjoys rock music" (opposed to mod (n.1)) is recorded from 1963, from rock (v.2).
Slang off (one's) rocker "crazy" is attested by 1897 according to OED; a widely reprinted 1903 newspaper column in U.S. identified it as British slang; the image is perhaps mechanical. To get (off) one's rocker seems to have been used earlier in U.S. baseball slang for "get busy, get active in a game" (1895) and does suggest the rocking-chair.