In 1873 Bismarck formed the Dreikaiserbund ("The League of the Three Emperors"), an alliance between Germany, Austria, and Russia. It didn't have a military component, but it was a beginning of cooperation between great powers.
Intervening events in the Balkans soured the relationship between Russia and Germany. So Bismarck pursued the Dual Alliance with Austria, signed in 1879. That was a defensive military alliance, in which Germany and Austria pledged each other support especially over against Russia. in 1882 it became the Triple Alliance when Italy joined them also.