Fascinating stuff. I know in the days of the press gang, naval ships would not lie alongside for long, if at all. They would be moored or anchored, and serviced by numerous wherries and lighters.
Merchant ships could be warped in or out of docks and harbours, and rowed too, in the days when labour was cheap (or free). I daresay horse power was used at times, and capstans turned by man power. Just the same, there was bound to be a lot of "waiting for the tide" and "waiting for a fair wind".
Sometimes ships were moved by using the tidal stream alone, and anchoring when the tide was foul. The anchors themselves could be moved using smaller boats, I think, and limited movement thus achieved that way. Man's ingenuity knows no bounds.
Albert Dock at Liverpool, now a museum, (part of Merseyside Maritime Museum
http://www.liverpoolmuseums.org.uk/maritime/ )is an example of a commercial dock system dating from just before the age of iron shipbuilding.