Loading container ships

When loading a container ship, how do the guys at the terminal know what containers go where? I know containers have their own location on a ship based on whether it is a reefer or based on what type of materials are inside, but all the containers stacked at the terminal look the same so how do the know what to put in? If you have thousands of containers at the terminal, how do they know to pick this or that certain container before another? Who directs all of this mayhem?

The Stevedores get a load list from the shipping line of containers that are on the terminal to load. The stpwage office of the container line give a prestow of where the containers for each port to be load. The containers on the terminal are seperated by weight and port of discharge. The Stevedore then follow the prestow that the line gives and loads heavies down and with each port, following a rotation so last port or so is loaded first . Eaxh Lines containers are in a seperated area from others , in a different row. Example, Maersk 25 - 28 ton boxes for Rotterdam are in a row and next to that would be 29 - 30 ton for Rotterdam. Same with K-line APL etc.
Stevedores direct all this mayhem, my job, for now

That is such a complicated process. Like a puzzle with 1000’s of pieces.

Exactly how it goes down as explained above. Typically empties are sorted by size and line. You update the piles of empties and the line planners just look at the piles and plan them for loading, as close to the where the vessel is docked as possible to increase production. The hardest part is managing the longshoremen, some are great and do their jobs extremely well, others don’t care at all. You can fire them but they can just pick the job right back up the very next day most of the time, here on the west coast at least.