A dock is a place built to make it easier to handle boats and ships. It is normally an enclosed space where gates keep the water level the same even though the tide may rise and fall.
A special case is a dry dock, which is a dock that can be completely drained (made dry) so that boats and ships can be repaired. Most ships in shipyards are built and repaired in dry docks.
A dockyard has one or more docks, warehouses and so on.
A quay is a place for loading and unloading ships that is open to the sea, and therefore experience changes in water level. Cruise liners arriving at Southampton, UK, tie up at a quay.
A landing place (quay) that sticks out into a river or the sea is called a pier. The most dramatic piers were built in the Hudson River for ships arriving at New York. The great transatlantic ocean liner cruise ships still dock against piers.
San Francisco was also famous for its piers.