Abstract: A composition is provided which, when applied to a metal surface, forms a corrosion-inhibiting film thereon. The composition comprises an epoxy resin, and a petroleum sulfonate, usually in a hydrocarbon diluent. The composition can further comprise a polyamine, an alcohol or both. The composition is applied by contacting the metal surface with the composition as one solution or as a hydrocarbon solution of the epoxy resin and a solution comprising the petroleum sulfonate. The composition is particularly useful in the treatment of downhole metal surfaces in oil and gas wells to inhibit the corrosion of the metal.