If your dog barks at the doorbell, the vacuum cleaner, noises in the hallway or other events in his environment, then you should work on desensitizing him to those noises. There are many reasons why it is important to work on barking problems including neighbor complaints, repeated anxiety for your dog, and the fact that barking is often a beginning indicator of territorial aggression. You can also read my post on barking out of the window or behind a door or fence, which can lead to barrier frustration.
Dog Training Blog
Barrier Frustration can occur if a dog is behind a window, fence, or on leash and is not allowed to interact with the environment. After a while, she may get frustrated and aggressive. One indicator of Barrier Frustration having a part in aggression is if a dog barks behind barriers and is calm around dogs when off-leash, but is very aggressive behind a barrier or on-leash. Dogs, of course, can also show aggression no matter how much they are being contained as well.