From the summary of The Posse Comitatus Act and Related Matters: The Use of the Military to Execute Civilian Law (R42659, Nov. 6, 2018):
The Posse Comitatus Act outlaws the willful use of any part of the Army or Air Force to execute the law unless expressly authorized by the Constitution or an act of Congress. History supplies the grist for an argument that the Constitution prohibits military involvement in civilian affairs subject to only limited alterations by Congress or the President, but the courts do not appear to have ever accepted the argument unless violation of more explicit constitutional command could also be shown. The express statutory exceptions include the legislation that allows the President to use military force to suppress insurrection or to enforce federal authority, 10 U.S.C. Sections 251-255, and laws that permit the Department of Defense to provide federal, state and local police with information, equipment, and personnel, 10 U.S.C. §§ 271-284.