You can buy depth stops to attach to drill bits to make blind holes at a certain depth. But for occasional jobs you can gauge depth by using masking tape around the bit at the right depth. Or, as shown, drill through the center of a dowel section, using the bit you need for the hole. Cut the dowel so the exposed bit will be the depth needed for the hole.