Pirates do hit container ships, actually some even hire hackers to locate the high value cargo to steal. A bankrupt shipping company doesn't really change much, since the ship is still worth millions. If pirates stole and abandoned the ship then at worst salvage laws apply, and a salvage company would go out and take over. The ships aren't worthless because the company is bankrupt, there's just an issue with operating costs and companies not wanting to shoulder them.