You never know when a great idea will pop up. Just ask Doug Ratner of idratherbewithmydog.net, who turned a catchy music video about dogs into a full-time e-commerce business.

In 2013, Ratner wrote a song titled “I’d Rather Be With My Dogs Than Be With You” and put the music video on YouTube. The song and video proved so popular that Ratner eventually put his 15-year music career on hold to make T-shirts with the phrase.

Doug Ratner and German shepherd Oggy present a $2,100 check to the American Cancer Society to fight canine cancer.

Doug Ratner and German shepherd Oggy present a $2,100 check to the American Cancer Society to fight canine cancer.

“I said to myself, ‘This is crazy. I think I have something here. I need to put this on a T-shirt,’ ” Ratner said. “So I went from playing music full time to getting into e-commerce and building up the brand. That’s how it all happened.”

Ratner launched I’d Rather Be With My Dog in February 2014 with only T-shirts, but the website has expanded to include items such as tank tops, magnets, hats, tennis balls and dog treats.

The 29-year-old entrepreneur also makes breed-specific items like German shepherd T-shirts inspired by his dog Oggy. More than 20 other dog breeds are available for placement on apparel, including English bulldogs, Labradors and golden retrievers.

“Essentially the brand is a department store for everything a dog owner could possibly need,” he said. “Whether you want high end T-shirts to wear to the bar, you want something to work out in, or you just want poop bags. I envision the company as a one-stop shop.”

Ten percent to 15 percent of each purchase on the website goes to charity, which Ratner said was his goal when he started the brand. Each month he switches the charity that his website supports.

In October, Ratner is participating in a Canine Cancer Awareness campaign in which he will donate 10 percent of all sales to help find a cure for canine cancer.

Ratner has built up a sizable following on social media, which he manages himself. On Instagram, @idratherbewithmydog has more than 177,000, and 16,000 people have liked the business on Facebook.

But his brand is not without copycats. Ratner said he spends hours each week reporting people who have taken his copyrighted phrase “I’d rather be with my dog,” and put it on their own T-shirts.

Ratner speaks fluent Yiddish and grew up in Massachusetts, where he attended Hebrew Day School at Heritage Academy. He now lives in Atlanta and operates a warehouse in Chamblee but travels frequently to make sales calls at pet shops all around the United States.

The downside to his life on the road? His two German shepherds have to live in Massachusetts with his family.

“Talk about how much I’d rather be with my dogs,” he said. “I go home about twice a month just to be with them.”