Dogs are descendants of the grey wolf, one of man's natural enemies... They are the enemy, treat them as such.
Dogs have sharp teeth and hunting instincts which can be triggered by a moving bike. As said above dismount, keep the bike between you and the dog. Yell at it and raise your hand as if holding a stick or a stone. Even better have a stick with you.
If the dog attacks you can crush it with your bike (better when fully loaded touring bike) or body slam it and go for a rear naked choke. Or kick the **** out of it.
btw, I don't like dogs