He admitted assault and public order charges and told a court he had been drinking spirits on the night, which he was not used to.
Judge Patrick Clyne said that he would leave him without a criminal record if he stayed out of trouble for seven months.
McDermott, of Windmill Avenue, Crumlin, pleaded guilty to public drunkenness, causing a breach of the peace and garda obstruction at Camden Street on June 3 last.
He also admitted assaulting Garda Robert Fitzharris at Kevin Street Garda Station.
Garda Fitzharris told Dublin District Court he went to Camden Street at 3.15am after a complaint from the Palace Nightclub, where McDermott had been refused entry.
When spoken to, McDermott was "very much under the influence" of alcohol and told the garda to "f*** off".
He was told he was being arrested for being drunk and a danger to himself and others. When placed in the back of the patrol car, he was very aggressive and had to be restrained.
He repeatedly shouted at the gardai and "made reference to the fact that he was a member of the Irish Army".
In the garda station, he made reference to the fact that he "had used firearms and that he was an excellent shot".
He also referred to shooting Garda Fitzharris. McDermott attempted to punch and kick gardai and at one stage attempted to bite Garda Fitzharris. He was taken to the custody area where he refused to be searched.
McDermott admitted his behaviour had been "disgraceful" and told the court he had not drunk spirits since the incident. Because of the court case, he had missed out on duties abroad.
McDermott had initially pleaded not guilty to the offences as he had a "completely different notion of what happened on the night".
"Part of the problem is, there tends to be a culture of drinking in the armed forces,"Judge Clyne said.
He adjourned the case to July and said he would dismiss the charges if McDermott did not come to garda attention in the meantime.