I ride on/off the C&O Canal a lot, it is a few miles from my home and convenient. There are lots of dogs near the entry points, some unleashed.
I got chased by a small fox terrier a few weeks ago, at the end of a 30 mile ride, leaving the canal, up a steep hill for the two miles back to my home.
I realized the dog was not going to stop, I was in the wrong gear to accelerate. I went to kick the dog, and forgot I was clipped in. His snout hit my pedal hard enough to make him stop and head back to his owner. The guy had an Autozone shirt on.. I saw him a few days later in the local store and I reminded him to keep his dog leashed. He remembered me and apologized.
But, lesson learned by me - unclip if a dog approaches!