This behavior may come from simply a fear of the loud noise. If your dog is afraid of thunder, they won't react much better to a rifle firing. The sense of hearing they have is much above our own, and so through the discharge of a weapon is deafening to us, it can excruciating to their heightened sense of sound.