I had the same problem a few years ago. I took the shock off and it was totally knackered. The telescopic bit could rock back and forward in the housing and that was making the knocking noise.
Difficult to check for with the strut still on the car...