Diatomite (DME) consists of natural ordered porous structures that are excellent candidates as microcontainers. However, to the best of our knowledge, the application of DME loaded with corrosion inhibitors in anti-corrosion coatings has not hitherto been reported. In this study, DME has been used as a source of microcontainers to load benzotriazole (BTA) inhibitor by an immersion method. In order to prevent unwanted early release of the small molecule BTA inhibitor from the DME microcontainers, inspired by the adhesion characteristics of catechol and amine in mussel adhesion protein, polydopamine (PDA) was coated on their surfaces to generate BTA@DME/PDA microcapsules. Because of the depolymerization characteristics of PDA at low pH, the synthesize microcapsules showed a controllable release function. The SEM morphology, chemical structure, and loading capacity of the synthesized BTA@DME/PDA microcapsules were characterized. The corrosion resistances of epoxy coatings with different contents of BTA@DME/PDA microcapsules were compared by saline immersion and electrochemical impedance tests. A scratched coating with 5wt.% BTA@DME/PDA microcapsules showed the best anti-corrosion effect.