Someone taps on the wall next door and your dog runs to the front door. To them, a knock may predict a visitor, a rush of noise, or a chance to bark. Shouting "quiet" over the barking adds more noise without changing that expectation.
For real visitors, use a secure gate or a separate room before opening the door. A worried dog should not be pushed to greet guests. If barking has suddenly increased, seems linked to pain or confusion, or comes with aggression, ask your veterinarian and qualified behavior help. For ordinary knock-related barking, start practice at a level your dog can handle.
Make a tiny version of the sound
With the dog relaxed and no guest arriving, make one soft tap away from the door and immediately offer a treat. Stop before the dog is upset. Repeat briefly over days, adding volume only when they remain comfortable. Separately teach a cue to go to a bed or mat, rewarding them for settling there. Then pair a soft knock with the mat cue. Do not move straight to a loud pounding sound or surprise visitor.
Ask friends to message before arriving while you train. This lets you put the dog safely behind a barrier rather than improvising with the door half open. Later, a helper can make a gentle real knock while you reward the dog's practiced routine. If the dog barks hard, lower the difficulty next time.
The goal is not to erase every alert. It is to help your dog recover and give you time to answer the door safely. The doorbell and knocking guide offers more ideas for practising sounds and the arrival routine when no one is at the door
Sources: Dogs Trust: How to prepare your dog for visitors. Dogs Trust: Barking - causes, triggers and how to help.