Shower problem calls for permanent solution!

I live in a six year-old two story home, and when the shower or bath faucets are turned on in the bathroom, the cold water pipe vibrates and makes a knocking noise. I’ve located the spot in the basement where the pipe enters the interior wall, on its way upstairs, and I can feel the pipe moving if I put my hand on it. If the water is shut off, then on again, it usually stops the sound for that shower or bath event. How can I solve this problem permanently?

Pipe noises are annoying. When you hold the pipe while it’s vibrating does the sound stop? If so, then applying spray foam around the pipe where it enters a hole in the interior wall heading upstairs should dampen the sound permanently. You may have to cut a hole in the wall and find some place mid-run where the pipe can be anchored solidly in the same way. If the pipe is copper (and it probably is), be sure to use a copper anchoring strap if you can’t use foam. When steel or aluminum contacts copper pipe it causes corrosion over time.