Sounds like you need to establish yourself as the pack leader. Make sure your dog feels protected and the other dogs will sense that you're in control. Also, working on focus exercises with your dog could help a ton when dealing with distractions like unleashed dogs coming your way.