Mine does this after I flush the toilet once the cistern fills up. I guess its loose pipes or something knocking when the pressure increases when the water turns off.
That’s water hammer (or surge, or may other names), basically the water in the pipe has momentum, so when the valve closes suddenly it hits the valve with a thud as the energy is dissipated. On long pipes it can be quite a lot of energy so things like unsupported corners get a bit of a jolt.
So it could possibly be a tank in the loft or a cistern opening and closing (and if its at random rather than a short time after you’ve used water elsewhere it means something somewhere is leaking).