Image copyright Thinkstock Image caption Do you know where your bananas came from and how they reached the supermarket?

Next time you're doing your grocery shopping and put a bunch of bananas in your trolley, spare a thought for the journey they've been on.

Many will have travelled half way round the world tightly packed in containers stacked high on gargantuan cargo ships.

So how do they stay fresh as they traverse the high seas, perhaps for weeks at a time?

Well, there's a lot of technology involved.

Danish shipping giant Maersk Line equips its 270,000 refrigerated containers - known as reefers - with Remote Container Management (RCM) tech that allows the company to track data such as location, power status, temperature, humidity and ventilation settings, even while at sea.

The reefers wirelessly beam data to a transmitter on the cargo ship, which then relays it to a satellite.

Maersk and other shipping companies have to pay compensation to suppliers if there's a power outage and a shipment of bananas - or any other perishable foodstuffs - goes bad, so prevention can save millions.

Image copyright Maersk Line Image caption Bananas grown in Ecuador....

Image copyright Maersk Line Image caption ...are cleaned, packed and loaded on to refrigerated - "reefer" - container trucks...

Image copyright Maersk Line Image caption The reefer full of bananas is loaded on to a cargo ship bound for China and remotely monitored

Image copyright Maersk Line Image caption ...and the bananas finally arrive in Chinese grocery stores, hopefully in good condition

Catja Hjorth Rasmussen, head of RCM at Maersk, says the sensor tech has helped the company remotely spot and remedy 300 instances of temperature malfunction this year. That's a lot of potentially expensive compensation claims avoided.

"By using the collected data points from RCM we can, via the help of an algorithm, predict the expected condition of the reefers before arrival at our depots," says Ms Rasmussen.

This helps to achieve much faster turnaround times.

"If a reefer is healthy it goes through a 12 minute visual inspection," she says, "compared to a six hour full inspection."

Car Tetris

The shipping industry is using a range of such technologies to cut costs and improve efficiency. It needs to.

A global trade slowdown following the financial crash of 2007/8 has seen a reduction in demand for goods, leaving as much as 10% of the container shipping fleet sailing around empty, says Philip Damas, a director at maritime research consultancy, Drewry.

South Korea's biggest container operator, the Hanjin Shipping Company, filed for bankruptcy in August.

Media playback is unsupported on your device Media caption Challenges ahead for global container shipping industry

So the more goods you can safely fit inside a shipping container, the better. And that applies to cars.

Pierro Filipin, innovation manager at manufacturing research centre WMG, based at Warwick University, has developed software that can work out how to squish the most cars in one of those metal boxes. He likens it to a game of Tetris but with thousands of pounds worth of vehicles.

These containers used to fit about three or four, but can now squeeze in up to six, says Mr Filipin.

Image copyright Trans Rak Image caption Trans-Rak software works how to fit the most cars into a shipping container

"Previously it was done by basically taking a photo of the car, cutting the shape, scaling it in Photoshop so it was in the right proportion, then manually trying to fit the various combinations by hand," he says.

Now his algorithm, which he developed for car-racking specialist Trans-Rak, works this out automatically by accessing a vehicle database that includes all the dimensions of each car.

"The cost of shipping a container overseas is something like £5,000," says Mr Filipin, so the more stuff you can cram in each unit without damaging the goods, the more cost-efficient it is.

Robot cranes

Another way to increase efficiency is to automate cargo terminals at ports.

For example, Rotterdam's Maasvlakte II facility, run by APM Terminals and Rotterdam World Gateway, features giant remote-controlled ship-to-shore gantry cranes for unloading the containers; battery-powered automated vehicles for moving the containers to the storage yard; and more robot cranes on rails for stacking up the boxes.

Image copyright APM Terminals Image caption APM Terminals' Maasvlakte II cargo terminal is almost totally automated

All this is powered by wind-generated electricity, thereby reducing CO2 emissions. And APM says such automation can improve productivity by 40%.

No wonder a growing number of cargo terminals around the world are adopting this kind of technology - often to the concern of dockworker unions who fear, rightly, that robots are replacing human jobs.

Bigger is better

Building bigger ships can achieve economies of scale.

This month one of the largest ever container/roll-on roll-off ships - conro for short - was launched in Liverpool. At 300m (984ft), the Atlantic Sea, owned by Atlantic Container Line, is the length of three football pitches put together and can carry 3,800 containers and 1,300 vehicles.

Meanwhile, global engineering firm Rolls-Royce is working on unmanned "drone ships" that can be operated via a land-based control centre.

It envisages one small team of seven to 14 people managing an entire fleet of ships dotted around the world's oceans.

Image copyright Rolls-Royce Image caption Rolls-Royce envisages unmanned remote control "drone" cargo ships...

Image copyright Rolls-Royce Image caption ...being managed from hi-tech land-based control centres

Given that there are more than 50,000 cargo ships operated by around 1.5 million people, it's easy to see how drone ships might seem attractive option for cost-conscious shipping companies, leaving aside the obvious safety and security issues.

Technology can also help reduce operating costs.

For example, fuel "is one of the biggest costs for container ship companies," says Rowena Bataille, head of marketing and product design at Inatech, a Glencore company.

Inatech has developed cloud-based software to help shipping firms buy fuel more cost-effectively - an essential requirement as cargo ships come under increasing regulatory pressure to reduce carbon emissions.

Speedy delivery

Once the containers have been unloaded from the ship, they need to be transported by road, rail or barge to distribution warehouses, before the goods finally reach supermarkets, shops and showrooms.

Speed is of the essence.

This is why Dubai's DP World, one of the world's largest port operators, recently pumped $50m (£40m) into Hyperloop One, the firm aiming to build a high-speed transport system based on vacuum tubes.

Image copyright Getty Images Image caption Hyperloop One hopes its tube-based high-speed transport system will be ready by 2020

Hyperloop was originally the idea of Tesla and SpaceX entrepreneur Elon Musk.

As part of the agreement, the two companies will explore building a network for launching containers at high-speed between the Jebel Ali Port to a new inland depot in Dubai.

So as your mind begins to turn towards Christmas shopping, spare a thought for how all those consumer goods arrived on the shelves.

Additional reporting by Matthew Wall.

Follow Technology of Business editor Matthew Wall on Twitter

Click here for more Technology of Business features