You can loot barrels by attacking merchant ships. To loot a merchant ship you need to ensure you have a decent sized convoy (7+ ships). When you see a merchant convoy (indicated with the ‘scales’ when you highlight it) engage a battle by pressing . If your combat strength is far greater than the convoy’s, it will surrender and all loot on board will be yours for the taking.
This will take some grinding as most merchant ships won't have many barrels on board and besides from looting, there is very little reason to attack merchant ships. The best way to do this is to make a save when you have a strong convoy, then attack every ship you can find. Once the achievement unlocks, reload your save as all nations will likely be at war with you.
NOTE: This does not have to be done in one game as it carries between saves.