Port operators and dock workers have reached a tentative pay deal to end strike action that has left cargo ships anchored off US ports.