A hard drive dock can refer to two different things, one inside a computer and one outside. Each of these items performs the same function in a completely different way. They secure a hard drive and provide a means to safely use the hardware. Internal docks are little more than a metal shell; external docks have full drive control hardware and a cable to allow interfacing with a computer.
Hard drives store information on magnetic disks called platters. These platters spin very fast inside the drive. The spinning and vibration that a standard hard drive generates will cause it to move if unsecured and build up a static charge. To keep the drive in one place and safely dissipate static electricity, computers will use a hard drive dock.
An internal hard drive dock seems like it is simply a cradle with screw holes. These docks are typically shaped like a "U" with several holes in the side. There are many more holes than what is found on a standard hard drive, which has four. These additional holes allow for drives from any manufacturer to fit inside a single universal dock.
Putting a drive into one of these bays is a generally considered a simple affair. Drives may be slid into the dock so the end with the cable hookups is towards the motherboard and the flat end is away. The four screws are put through the dock wall and into the drive, securing it in place. The metal screws contact the inside of the drive and the metal bay; this allows the static that the drive generates to dissipate into the computer’s frame.
An external hard drive dock holds a standard hard drive inside an enclosure. The design of external enclosures varies greatly, but it generally falls into two groups. In the first, two metal rails are screwed to the drive, which is then slid into the enclosure. Small cables are hooked to the back of the drive, and then it is all screwed together, making the drive inaccessible while the computer is running. This type of enclosure is common for external hard drive docks that only have a single drive within them.
The other type is similar to an internal hard drive dock, but without the rest of the computer. The drive slides into a compartment and receives normal hookups. The drive may be on rails or clipped into place. The enclosure usually has a door, which may be opened and closed while the dock is in operation, giving access to the drive. These types of hard drive docks will often have space for more than one drive.