The battery pack could be in the trailer, which could charge up from the power grid while being loaded and unloaded.
Diesel electrics (as in locomotives and large trucks) typically don't have batteries. They use the diesel to spin a generator, which directly powers electric motors in the drivetrain.