My understanding is that ships in the age of sail (17th - early 19th Centuries) were fairly limited on what points of sail they could travel, and fairly un-maneuverable in any case: this seems like it would make it hard to sail into a lot of harbours and dock.
On top of this, once they were in the harbour, without tugboats like modern ships, how would they do they maneuver in the potentially crowded and shallow water, and then pull up alongside the quay. would there be tow boats, would they kedge into the harbour or is there some other cool technique i'm missing?
or have I got it wrong and ships would usually just anchor in the harbour, and transfer the cargo ashore in smaller craft?
They would use a variety of techniques, which all basically boil down to getting close enough to the dock to get lines ashore, then using the lines to haul the ship into the dock.
Depending on the approaches to the dock, the ship might sail close enough to the dock to get lines ashore (using only a few sails set and rounding up into the wind, or 'heaving to' close enough to the dock to get lines ashore), she might be pushed close enough to the dock by oared boats.
How close she would need to get would vary. Easiest if she could get close enough to throw 'heaving lines' ashore. A 'heaving line' is a light line with a 'monkey's fist' knot tied around a small lump of lead attached to the end (to make a weight). A skilled seaman can throw a heaving line 60 or 80 feet. The heaving line would then be used to haul a heavier cable ashore and the cable (or cables) used to 'warp' the ship into the dock.
If the ship could not safely get close enough to the dock to use heaving lines, a small boat could carry a 'messenger line' from the ship to the dock, and again, this would be used to haul a cable ashore and warp the ship in.
Ships would generally dock if they had to load or unload a considerable amount of cargo, and if there were docks available. If they were not transferring much cargo, or if there were not docks available, they might anchor, and smaller boats (called 'lighters', usually with both oars and sails) would carry cargo between the anchored ship and the shore.