At the outbreak of the Civil War, Cockrell, a slaveowner, organized a company of pro-southern Home Guards and was elected its captain. The group joined the army raised by Sterling Price to resist the Union occupation of Missouri and fought with him at Wilson's Creek (10 Aug. 1861) and Lexington (14-20 Sept. 1861). In December the Missouri Home Guard became officially part of the Provisional Army of the Confederate States, and Cockrell received a Confederate commission as captain. His company participated in the battle of Pea Ridge (7-8 Mar. 1862) and then was transferred with other Missouri troops to Mississippi. Cockrell gained promotion to lieutenant colonel on 12 May and to colonel on 20 June and was given regimental command. His regiment engaged that fall in the battles of Iuka (19 Sept.) and Corinth (3-4 Oct.) before retiring to the Vicksburg area, where they were involved in all of the major battles of that campaign.
Cockrell was promoted to brigadier general in the aftermath of Vicksburg's surrender. Following his parole and exchange, he received the command of the reorganized First Missouri Brigade, which he led throughout the remainder of the war. His brigade served in Mississippi and Alabama during the latter half of 1863 and early 1864. In May 1864 Cockrell's brigade joined General Joseph E. Johnston's forces opposite Union general William T. Sherman in the defense of northern Georgia and Atlanta, during which Cockrell was wounded at the battle of Kennesaw Mountain (27 June).