We provide a complete classification of the possible cofinal structures of the families of precompact (totally bounded) sets in general metric spaces, and compact sets in general complete metric spaces. Using this classification, we classify the cofinal structure of local bases in the groups $C(X,bbR)$ of continuous real-valued functions on complete metric spaces $X$, with respect to the compact-open topology.