Rockruff is literally in your backyard. Relatively speaking. To catch one, you’ll first have to defeat Kahuna Hala. Once you do, he’ll reward you with a Ridge Pager, an item used to summon a Tauros. Call in and mount the Tauros, head back to your house, and ride down toward the beach and the Pokemon Research center.
After you reach the research center, head left toward Ten Carat Hill. Continue heading this way, crossing through the cave. Continue heading left, using Tauros to break through rocks. Eventually, you will reach an unbreakable boulder. Once you reach this, go right toward Farthest Hollow.
Farthest Hollow is where Rockruff lives. It can take a while to catch one; they don’t spawn all too often in this area. When you do encounter one, be careful to avoid knocking it out when attempting to catch it. Like other Pokemon, it’ll help to wear down its HP before throwing it into a Pokeball, but if it gets knocked out, you will be unable to try.
Rockruff eventually evolves into Lycanroc, and takes one of two forms, depending on which version you’re playing.
In Sun, you’ll get Midday Form Lycanroc, a dog-like Pokemon with high speed and attack stats.
Moon’s version is Midnight Form Lycanroc, a more nightmarish-looking werewolf creature who moves more slowly than its Midday counterpart, but has a higher defense rating.