Years ago I was riding on a tandem with my 12 year old son. Shortly after we caught up with a small group of single bike riders a group of 5 dogs charged out at us. Each of the single bike riders produced their weapon of choice - a water bottle, a pump, one woman had some sort of high tech sonic thingie. My son and I didn't do anything. When it settled out, each single bike rider had a dog barking at their heels. The dogs left my son and me alone.
I think that dogs can smell fear and react aggressively toward it.
I've got some other good dog stories but I get nervous everytime that this topic comes up. It's like talking about not getting punctures.