Sheffield Crown Court heard how Shaun Sanderson, aged 42, had visited the women, whom he knew, at the flat and became aggressive after refusing to leave.
Ben Hammersley, prosecuting, said Sanderson woke one of the occupants at the flat in Barnsley as he was banging on the door.
Mr Hammersely added: “He was banging on the door and asking about coming in for a drink and she said, ‘What are you doing? Have you seen what time it is?’.
“After telling him to leave, he became aggressive.”
Mr Hammersley said that after being asked to leave Sanderson kicked the door and pulled the woman back to the kitchen and punched her in her face.
The woman spotted that Sanderson had a knuckle duster while she was on the floor and he hit her over the head and punched her again with both fists, according to Mr Hammersley.
Mr Hammersley said Sanderson went to put the woman in a headlock and as she broke free he tried to attack a second woman with a bag of bottles as she appeared.
The court heard one of the two women fled to a neighbour’s property and called the police.
Mr Hammersley said police arrested Sanderson on Oldroyd Avenue, Barnsley, after officers responded to reports of a man in the street with a knuckle-duster.
Sanderson, of Park Avenue, Grimethorpe, Barnsley, told police he had been drinking heavily and he had no recollection of the offending.
Sanderson, who has previous convictions, pleaded guilty to causing damage, battery, assault occasioning actual bodily harm and to possessing an offensive weapon in public after the incident on June 6.
Sean Fritchley, defending, said father-of-seven Sanderson is a reformed heroin addict who had been getting his life on track and his previous convictions relate to his heroin addiction.
Mr Fritchley added Sanderson had considered the women he attacked to be his friends and his probation report states he is is ashamed and remorseful and he claims he will never drink alcohol again.
Recorder Megan Rhys sentenced Sanderson to 20 months of custody and imposed a two-year restraining order.