The dog I have now was 2 when we got her and had lived in kennels 23 hours of the day, for those 2 years. The breeder told me she had never even seen a cat so we took a risk - but she was fine with the cat. To the point they're now two old ladies who spend all day together, curled up asleep!
We did a slow introduction and had a baby gate up so the cat could always make a run for it, if scared. Not that she ever was as wwe already had another dog.
He was a different story. He came home as an 8 week old pup. At that point, the cat was bigger and outranked him. One of the first things she did was thwack him right in the eye with her claws out when he tried to eat from her bowl. After that he had a lifelong, ehalthy respect of the cat. He grew into 50lb of solid staffie muscle. The cat stayed tiny. But he always saw her as his mum, kind of thing and just adored her. He also picked up a few of her habits - like lying along the back of the sofa... Not so cute when he fell on us! If she entered the room, he'd make a beeline for her and she for him - she'd weave in and out of his legs, and rub her head on him. When he died, she was distraught.
We recently fostered a dog for a while but it didn;t work out as it had a massive prey drive - and my cat was prey. She is elderly now, and it wasn't fair on her, so the otherwise lovely doggy had to move on to a cat free foster. So be warned - you can fall in love with a dog that isn;t cat friendly and it can just not work out. She was only a couple of years old, and the rescue told us she was cat proof. Turned out they had vaguely thought as there was a cat around the kennels and she was bound to have seen it - must be OK with cats. I since discovered other rescues are much more rigorous about truly checking a dog is OK with cats. So don;t let it put you off rescue but double check the rescue isn;t so desperate to rehome the dog, they're fudging the truth - as happened to us.
So in my experience it's perfectly possible unless the dog already has a high prey drive. I think in some ways a cat proofed rescue dog - that could be demonstrated to you was cat-proof - would be ideal. But puppy also works. And as I say my current dog had not even seen a cat in her entire life and is a breed that is notoriously cat-hating - but worships the cat and always did.
Older dog = check it's cat-proof.
Puppy - you can bring it up with the cat so no problem.