George Washington
Andrew Jackson
Zachary Taylor
Ulysses S. Grant
Dwight D. Eisenhower
All of these men were elected immediately AFTER a war, or fairly soon thereafter. Taylor was in office only a short while, so his presidency really doesn't count.
Grant was coming off the Civil War, and it was a generation before the nation was ready to fight over anything.
Washington was the first president, when the nation was just getting started. Having defeated the British, he no doubt felt it good to keep a low profile, as we were really not capable of taking on France or Britain again at that time.
By the time of the War of 1812, the United States had become a far-flung battleground of the Napoleonic wars in Europe. Jackson was a hero of the defense of New Orleans. As he instigated several attacks on Indian tribes, I don't think his presidency can be considered peaceful.
Eisenhower pursued the Cold War, which had many fronts, including Viet Nam.
In short, electing a general doesn't guarantee peace; it is simply an accident of history.
You omitted Brigadier General William Henry Harrison on this list.