Both problems may be solved with the same tool: the objects are represented (modelized) by colored mixtures.
Similarity: the experimentalist looks for identical parts among a family of at least two objects. Most of the time, this is done by computer via an optimal superposition of the objects. In the simplest situation, the objects are finite sets of points. Data analysis methods of optimal superposition of two sets of points are known as Procrustes methods. In chemistry and biochemistry, the optimal superposition of sets of points via least squares techniques are known as RMS (Root Mean Square) methods: calculations of RMSD (Root Mean Square Deviation).
Docking: the experimentalist looks for the geometric complementarity of two objects, as in the key-lock model. This recognition of shape complementarity may be done by computer, but it occurs spontaneously in the real life, such as for enzymatic recognition.