Phillip Sargeson, 38, brandished the weapon at Hasland’s Devonshire Arms on March 19, before running off across a garage forecourt into a shop.
Prosecutor Becky Allsop told Chesterfield Magistrates Court: “He was followed by occupants of the pub and detained at the store until police arrived.”
The court heard Sargeson’s behaviour had a “massive impact” on those who witnessed it.
District Judge Andrew Davison said: “They were frightened, they were cowering, he kept going back.”
Sargeson, of Wordsworth Road, Newbold, admitted threatening behaviour.
The judge, adjourning the defendant’s sentence pending a probation report, added: “I need a report - there may be underlying issues.
“Whether it’s mental health or drink or drugs or all three.”
He was bailed unconditionally until May 26 - when he will be sentenced at Chesterfield Magistrates Court.