Bluff and bowlegged, with a neat side part in his hair and a spine as straight as a schooner’s mast, Brad Pitt strides into “War Machine” in a gust of masculine self-assurance. The sardonic tones of the accompanying narration — voiced by someone whose identity will be revealed later on — are an early indication that Mr. Pitt may not be the hero of the story. Glen McMahon, the four-star general he is playing, has no doubts on that score. McMahon, a man of many macho nicknames (the Glenimal, for example) is a man’s man, a soldier’s soldier, a warrior with the soul of a poet — the walking embodiment of just about every cliché in the book.

But the particular book that inspired “War Machine,” “The Operators” by Michael Hastings, is a sharp, nuanced deconstruction of the modern military mythology. The book grew out of a notorious Rolling Stone profile of Gen. Stanley A. McChrystal, who was put in charge of the war in Afghanistan in 2009 and proceeded to blow up his own career. Mr. Hastings, who died in 2013, sketched a rollicking, damning portrait of a commander in over his head, enthralled by his own hype and in less than perfect control of his mouth. That’s the guy Mr. Pitt is supposed to be.

In adapting Mr. Hastings’s journalism, David Michôd, the writer and director of “War Machine,” also streaming on Netflix, has taken some risks of his own. The movie is fiction, but it hugs the shore of reality, occasionally running aground on the facts. It’s a bit awkward — though not unusual — for semi-invented characters to brush up against real people. Anthony Michael Hall plays a volatile colleague of McMahon’s who seems to be based on Gen. Michael T. Flynn, whose more recent adventures may provide fodder for a sequel. The actual President Obama appears on a television news clip, and is played later in a brief scene on an airport tarmac by an actor named Reggie Brown. Ben Kingsley wickedly impersonates Hamid Karzai, at the time the president of Afghanistan.