Hapag-Lloyd earned record second-quarter operating profit as the German ship line’s volume rose 7.8 percent and average per-container rates jumped 29.9 percent.