That's exactly how it is. Unfortunately the negative externality of pollution means there is an inefficiency. One way to fix this by applying a tax, or minimum environmental standards, but on an international scale it's not so simple.
Pollution tax on international scale isn't too hard: countries can just impose the tax on any ships that dock at their harbours, and can negotiate double taxation treaties with cooperating governments.
Why not just tax only the cargo that is unloaded at the port, which would avoid the double taxation problem? It would also place greater revenue in the hands of the consumers that are paying for the shipment of those goods.
Depends. Ideally you want to tax something that's a good proxy for pollution. You don't want to tax trade.
There wouldn't be greater revenue for consumers: the money that pays for the taxes ultimately comes from them.
(Just to mention it: the standard solution for all revenue raising taxation is, "land value tax". Any other tax is only useful as a `sin tax'. Alas, right now we have sin taxes on labour and capital..)
No, it is not so simple but then we are not a small insignificant country. We already have the Jones Act which mandates American built+crewed+owned+flagged vessels for port to port cargo (cabotage) amongst things. So these sort of regulations are not without their precedent.