Not to sound completely idiotic, but what major dangers around docks are you referring?
Ship to shore power can be sketchy, concentrations of sewerage, gasoline etc can find you, overhead traffic, more klutzes dropping stuff. Essentially you're diving under what can be an active community. Also as mentioned lost stuff that can snag & entangle, high likelihood of silt outs and currents.
Obviously the term dock covers a wide gamut of circumstances. Diving near a private 1 slip dock and in a marina are 2 very different assignments.