Pricking holes in the rolled-out pie dough allows the steam to escape while it's baking. Without this, the steam would puff up in bubbles and pockets throughout the crust, which would make some parts of the crust cook too quickly and also result in an uneven surface for your filling.
Docking is simple. Just roll out your pie dough and lift it into the pan. After pressing it in and shaping the edge, prick it all over with a fork. Don't forget the sides! Do this whenever you need to fully or partially bake the crust before adding the filling.
Docking the crust serves the same purpose as using pie weights, and the two methods can be used interchangeably.
The only time when you might want to use pie weights instead of docking is when the filling is very liquidy, as with quiche or other pies that will be fully baked in the oven. In these cases, some bakers feel that the liquid can seep into the holes left by docking and make the crust soggy.
Related: The Kitchn's Best Pie Bake Off 2008!