Teach your dog to exit doorways (house and car included) only when told to. This is an important safety skill especially for dogs who tend to bolt away from you, but is not fool-proof (train the people to keep the doors closed too!).
1. Decide what your permission-to-exit-the-door word will be. Ideally it should be a word that you won't use casually. A good example is "exit". From now on all family members will need to say "exit" before allowing the dog out of the door or car door (even if you have not completed training).
2. Tie your dog back using a body harness and a tether so that he cannot make it out of the door. Have your treats available and yourself positioned by the door.
3. Open the door a crack. When your dog approaches the door, close it (be careful not to get his nose!). will soon realize that this is a trick and will not approach the door when you crack it open and this is the time to have a little party (reward him big-time).
4. Continue practicing this until he is consistently not trying to exit when you crack the door open. P/R (praise and reward) each time he decides to wait.
5. Now try opening the door up further and further until you can open it all the way. P/R him each time he waits and close the door each time he goes for it without permission.
6. Put him on a leash. Open the door all of the way. If he remains waiting, say "exit" and allow him to go through the door.
7. Repeat from the beginning without the tether but with a light 25' rope dragging or with a doorway that does not exit into dangerous area (like a yard or garage), then practice with no tether.
8. Practice this in the car.
9. Practice this with something tempting on the other side of the door.
10. Once you feel your dog has "got it". Continue to use your release cue "exit" and repeat the exercise of closing the door if he doesn't wait for "exit" to be sure that it remains fresh.