Daniel Delaney (20) thought staff were 'over the top' in their dealings with other inmates during an incident when he left his cell and threw the mirror.
The officer was struck on the back of the head but was not seriously injured.
Delaney was sentenced to two months' detention at Dublin District Court.
The accused, with an address at Mariner's Port, Sheriff Street, pleaded guilty to assaulting Officer Paul Breen at St Patrick's on April 10, 2011.
Garda Finbarr Brennan told the court the incident happened at about 10am on C1 Landing, where prison officers were restoring order after a disturbance involving other inmates.
Delaney's lawyer said he acted "out of frustration and to protect his friends".