I do not try to outrun dogs. If a dog shows undue interest while I am riding a bicycle, whether by barking or running, I slow down; if the dog appears in the least bit menacing, I stop, get off the bike, use the bike as a shield, and grab my pump. I don't wield the pump as a weapon, but it's ready if I need it. (I never have.) I try to radiate confidence, and communicate with words and body language that the dog better not mess with me, or else. Then I slowly walk away, always keeping the bike between me and the dog.
For me, no encounter has ever gone beyond this.
The worst situation I have been in is that a barnyard dog held its ground, and continued barking until I was far away. And that was fine. It didn't attack me, and I didn't need to attack it.
I have tried yelling at dogs, with mixed results. Sometimes an aggressive (or frightened) scream stops a dog in its tracks. Other times it riles it up.
A pack of aggressive dogs is the worse case scenario. It's never happened to me. If it did, I probably would be wishing I had pepper spray!