It sounds sort of like water hammer-it also sounds as though your water pipes are not secured properly. It could be rapid water expansion from air in the lines. I would start by turning off the water to my house and draining the entire system. This means flushing the waterheater as well. Once I knew the entire system was drainedI would open every faucet every valve and begin to repressurize the system. Once all of the air was purged out of the piping system I'd close all the valves. If this did not aleviate the proble, I would attempt to isolate the problem. Start this by shutting off the valve to the hot water heater on the inlet side. Then open the furthest cold water tap from the house main, see if it makes the noise. if not work your way back. If the noise is not found I would reopen the cold water inlet to the hot water tank and then begin the same process using only the hot water. If this still does not answer the problem I would begin to look for places to secure the water pipes in the attic and walls and subfloor. Good luck.