Most of them are OK.
I like them behind fences better, and don't tolerate dogs chasing me without a fence (there is one that "greets me" behind a fence almost every day, and I come to miss it if I don't see it for a few days).
A couple of years ago, I got an early start. I was going over a hill at the crack of dawn. Dog started barking, and the owner said it was OK, the dog was good (otherwise I would have said "stay" or something). Anyway, it lunged, and got a mouth full of handlebars. Apparently it didn't know where to bite a bicycle.
Loose dogs get yelled at.... "GO HOME".
I have one Golden Retriever, I think at the end of an out and back loop. Not much choice but turn around there. I told it to go home. So, it went to the corner of its property and sat and watched me. I have seen it a few other times without incident.
Another ride... late night, last leg of a 150 mile ride that I got a late start on. I passed a campsite. Dark. All I heard was the pitter-patter of feet coming up behind me. I yelled, and the dog broke off. But, I was just cresting a hill at the time... sometimes I think I would have been better off letting the thing chase me down the hill. Perhaps it wouldn't have found its way back. Then again, it was someone's pet. But, I saw people at the campsite, and didn't hear any indication that they were paying attention to their dog.
Coming past some farmlands south of Portland, I had a dog coming after me. I yelled several times, and the thing just kept coming. Moderately busy road. That is the one time that I've thought that pepper spray would have been a good idea. Unfortunately, that is so rare of an instance that I would never have it, and have it ready for a sprint and watching the dog at the same time.
I've been past there a couple of times, and never saw the dog again. Perhaps if the road was busy enough... the dog disappeared. Who knows, I was passed less than a minute after I had dog issues that one time, but didn't hear any crashing.