Commercial ships are always unarmed. In part it's just company policy, but there are also treaties that control such things and there are legal problems as they go from port to port under various different jurisdictions.
It's unfortunate. A couple of guys with rifles could make a big ship all but impossible to board.
This is exactly my thought. If I am captain of a vessel, I might hide some bootlegged weapons and a cash of ammo on board. Most likely there will be crew aboard with just enough experience, skill or training to keep suppressing fire on people struggling up a rope or ladder. When the threat passes or is quelled, toss the guns and ammo overboard and swear everyone to secrecy.
"What bullet holes? Those are new rust spots we shined on the way? It's purely cosmetic."
Heck a couple of guys with MAC-10s could stop 'em cold as they came up their boarding ropes or rope ladders. Be quite a sight it would. But fire hoses would work pretty well for that too. I think I have such manned at the stern and any other vulnerable points, 24/7 while in Pirate infested waters. (Off Somalia is not the only such place!)
BUT, it is the responsibly of the US Navy to protect US flagged vessels. They need to be putting guns and gun crews aboard all US flagged merchant vessels. If the ships are US owned or operated by US companies, no charge. If they are foreign owned a suitable schedule of "user fees" could I'm sure be arranged. Probably get a big discount on their insurance, which would make paying for the service worthwhile. I'd suggest that the larger ships be armed with 25 mm Bushmasters or 20 mm Gatling type cannon, in addition to heavy and medium machine guns and other small arms.