Commuting is bliss. Adding a dog to the mix well... that's heaven. How awesome to get to where you're going, and for your pup to get a workout in at the same time. It's the best.
Tips: Start small at first. Start with a traditional short, non-stretchy, non-retractable leash. Ride slow on an open path or road where people, dogs, cars, bikes won't be an issue. Ride with the dog to your right side, get them used to the bike and the spinning wheels. Learn to ride the bike with one hand while the other (right hand) manages the leash and keeps the dog off to the right side. Having them right next to you while learning is best. This keeps them from taking out your front wheel or getting a paw in the spokes. Keep the speed slow and if things go wonky on you just remember to let go of the leash and bring things to a stop.
What I've learned, at least for my dogs, is when they are running alongside me on my bike, they consider it "time to work" and they aren't distracted by things like dogs, people, rabbits -as they usually would be on a regular walk. Dogs really like this higher-speed exercise fix.
I've talked to my vet about this practice and she advises to always let the dog set the pace and dictate breaks and water stops. Don't ever pull the dog behind you or drag them along (obvi!). Check their paws often to be sure their paw pads are doing ok, and if it's hot, stop often and give them water. (They will usually gladly drink from your water bottle when they get thirsty enough). As with any exercise, build up and work into it slowly. If you have a puppy, ask your vet about this -it may not be wise with a young dog until their joints are fully developed.
Another key item to teach the dog is "stop" so they know what is happening when you come to a stop sign or red light or other hazard or obstacle.
The next best step for my dog and me was to graduate to an extendable-leash clipped with a carabiner to my waist- either to a fanny pack or to my backpack. This frees up both hands to focus on handlebars and brakes and allows the dog to run ahead, next to you, or slightly behind, while avoiding a slack leash that can get easily tangled up.
Here's a video to show that to you in practice: