It is good to know that dogs, even when they have bad intentions, seldom attack an person who watches them in the eyes. Several years ago, as I was walking to my dormitory in the suburd of Istanbul (where I was an exchange student) in the middle of the night when a herd of at least half-dozen loose big dogs followed me and growled at me for a long way. I remembered somebody telling me to look at their eyes and I walked about one km backward doing that and got 'home' safe eventually.
Generally in my experience, dogs go quite a bit slower than a bike. If the problem is recurrent, talking to the dog owner is also an option stangely not considered in previous posts.