hot water heater pipe knock

This is an issue I am having with my house, built in 2005 in south Florida. The hot water heater is in the garage and the piping for the water goes into the wall and on the other side which would be the master bedroom/closet/bathroom area. The noise/knock happends when you turn on the warm or hot water and the knocking is pretty loud then as you turn the water off it will still knock for like 30 more seconds. I have turned the water on and put my hand on the hot water pipe in the garage and you can actually silence/modify the sound from that pipe. I was told I need an expansion tank on the hot water heater because its expansion in that cpvc pipe that is causing this. Any ideas if that sounds right or what I could try.

Sounds like expansion ,Pipe could be mounted to firmly and does not slide in the fasteners very well.

Something like this may help.

You mean this. http://www.plumbingsupply.com/waterhammerarresters.html

Hello,
Possibly the vent is located in the attic space. Most plumbers do not want to cut a hole in roof and expose the home being built to outside weather conditions. Usually as soon as a roof is decked it is tar papered. Most penerations need to be coordinated with roofer. If there is no vent then that very well may be where the problem lies. Have someone dump peppermint extract in the outside clean out while you stay inside and smell. If you smell pepperment in the drain then this would be the first area to srart investigating.
Thanks

I have a pipe in the upstairs bathroom that does the same thing. The walls are steel stud framed, and the copper pipe is installed in a plastic clamping style strap. The sound is noticeable especially in the cold mornings.