A container ship was attacked by Iran in the Strait of Hormuz amid escalating tensions following US airstrikes against Tehran.