When formed through dynamical interactions, stellar-mass binary black holes (BBHs) may retain eccentric orbits (e > 0.1 at 10 Hz) detectable by ground-based gravitational-wave detectors. Eccentricity can therefore be used to differentiate dynamically formed binaries from isolated BBH mergers. Current template-based gravitational-wave searches do not use waveform models associated with eccentric orbits, rendering the search less efficient for eccentric binary systems. Here we present the results of a search for BBH mergers that inspiral in eccentric orbits using data from the first and second observing runs (O1 and O2) of Advanced LIGO and Advanced Virgo. We carried out the search with the coherent WaveBurst algorithm, which uses minimal assumptions on the signal morphology and does not rely on binary waveform templates. We show that it is sensitive to binary mergers with a detection range that is weakly dependent on eccentricity for all bound systems. Our search did not identify any new binary merger candidates. We interpret these results in light of eccentric binary formation models. We rule out formation channels with rates 100 Gpc−3 yr−1 for e > 0.1, assuming a black hole mass spectrum with a power-law index 2.