When formed through dynamical interactions, stellar-mass binary black holes 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 binary black hole mergers. Current template-based gravitational-wave searches do not use waveform models associated to eccentric orbits, rendering the search less efficient to eccentric binary systems. Here we present results of a search for binary black hole mergers that inspiral in eccentric orbits using data from the first and second observing runs (O1 and O2) of Advanced LIGO and Advanced Virgo. The search uses minimal assumptions on the morphology of the transient gravitational waveform. 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.