How did the ships in the 14th to 18th century deal with barnacles and other sea growth? Did they dry dock and scrape the hulls or was this done while at sea somehow?
A few different ways you could do it, and manage sea growth.
The first and most straight forward was to use copper plating to which was developed by the Royal Navy during the mid 1700's and by about 1790 the entire fleet was protected.
Before that various other methods had been tried, including adding extra layers of wood that could be replaced or attacked without harming the structural integrity of the ship. And yes between cruises it was desirable for ships to be taken into dry dock for a cleaning and replacement of any particularly degraded beams or planks.
The other more common method of getting access to a ships bottom and keel was known as Careening.
Basically you take a ship and beach it at high tide so that when it goes out the ship will be high and dry. Then you unload everything you can, lash everything else down, and shift ballast, and maybe use a halyard attached to a mast to basically pull the ship to one side, tipping it over and exposing half the bottom. Once completed you would do the same for the other side then refloat the ship. You could even try doing it at sea or in open water, known in Anglo sphere circles as a Parliamentary heel, but this obviously came with its own dangers, and less of the bottom would be exposed, and did result in the loss most famously the 100 gun 1st Rate Royal George.
Ships could also at times attempt to retreat up into bays and rivers towards freshwater in order to kill the saltwater growths.
The Line of Battle: The Sailing Warship 1650-1840
and Six Frigates: The Epic History of the Founding of the US Navy