R Lee Ermey. Had been a Staff Sergeant in the Marines after something like 11 years of service. Served time in Vietnam, and at some point post FMJ the Marine Corps made him an Honorary Gunnery Sergeant.
He had been brought on to FMJ as a technical advisor, but because he was so good at explaining it and showing it to the guy who was supposed to be the DI, Kubrick decided to have him play the full role. Also of note, given Kubricks massively micromanaging and controlling type of directing, Ermey has been one of the few actors Kubrick allowed to improvise dialogue and actions. A massive chunk of the DI stuff were things that weren't in the actual script.