Answer
With a solid-walled wharf, as the ship pulls alongside, the water is confined and squirts out toward the bow and stern of the ship. In the process it speeds up, which reduces the water pressure there. The greater pressure on the other side of the ship then pushes the ship toward the wharf.
If a wharf is made with pilings, water doesn't build up between the wharf and the ship and this won't happen.
Work Step by Step
This is discussed on page 273-275, and shown in Figure 14.23.