Sheffield Crown Court was told how the altercation at HMP Marshgate on June 26 this year took place after inmate, Benjamin Handley, was told by a group of three prison guards that he would not be able to do his laundry as planned.
Andrew Smith, prosecuting, told the court that Handley 'took offence' to this and after throwing his laundry bag in his cell, he went inside the cell and refused to come out.
The three prison guards waited for Handley, aged 30, outside the cell.
Mr Smith said: "He took his shoe and sock off, and put an item in his sock.
"They [the prison guards] drew their batons and stepped towards the defendant.
"The defendant swung the item in the sock and hit one of the officers in the back."
Mr Smith told the court that Handley hit the guard with such force that the contents of the item inside the sock, which he confirmed was a ring-pull tin of sardines, were flung out of the tin.
He explained how one of the prison officers then struck Handley, who was given an indeterminate sentence for assault and wounding with intent to cause grievous bodily harm in 2008, with a baton.
Handley then retaliated by spitting in the face of two of the prison officers.
The prison officer Handley attacked with the tin of sardines was left with reddening and slight bruising to his back, the court heard.
Handley admitted to three counts of assault and one count of possessing an improvised weapon, in connection with the incident, at an earlier hearing. He was moved from HMP Lindholme to HMP Doncaster, following the incident.
Defending, Rebecca Tanner, said Handley suffered a 'momentary loss of self control' during the incident, and had already spent eight weeks in solitary confinement as a result of his actions.
"He's already been told that in light of this there's going to be no prospect of release," said Ms Tanner, adding: "He does regret what he's done."
Judge Robert Bartfield sentenced Handley to 16 months, which due to the fact he is serving an indeterminate sentence means he will need to serve a further 16 months before he is eligible for a parole hearing.
He told Handley: "You put a can of sardines in a sock, which I'm told is a weapon occasionally used by inmates, and used it as a weapon.
"You swung it at the prison officer, it hit him on the back, which no doubt caused him significant discomfort and reddening.
"You spat in the face of two officers which was an extremely unpleasant, cowardly and disgusting thing to do."
Judge Bartfield added: "The courts have to give a clear message that it's going to be very costly for you if you assault prison staff."