"cut off or clip an animal's tail," late 14c., from dok (n.) "fleshy part of an animal's tail" (mid-14c.), which is from Old English -docca "muscle" or an Old Norse equivalent, from Proto-Germanic *dokko "something round, bundle" (source also of Old Norse dokka "bundle; girl," Danish dukke "a bundle, bunch, ball of twine, straw, etc.," also "doll," German Docke "small column, bundle; doll, smart girl").
The general meaning "deduct a part from," especially "to reduce (someone's) pay for some infraction" is recorded by 1815. Related: Docked; docking.
<a href="https://www.etymonline.com/word/docked">Etymology of docked by etymonline</a>
Harper, D. (n.d.). Etymology of docked. Online Etymology Dictionary. Retrieved $(datetime), from https://www.etymonline.com/word/docked