Banging noises in plumbing pipes is often caused by faucets that shut off so quickly that the flowing water wants to hammer on forward. This can be stopped by inserting a "water hammer arrester" into the line.
It is either a special air valve made for the job, or an 18 inch length of vertical pipe with a cap on it to trap air inside.
In both cases, it provides a cushion zone for the rushing water to go into, instead of banging into the shut off valve. It is usually installed under the sink near the offending faucet, dishwasher or clothes washer.