Andrejs Borodins - captain of the container ship Frifjord - was ordered to spend four months behind bars after he was found staggering and incoherent on board the 250ft boat.
He was caught after a pilot at Dundee harbour came on board to help him guide the 250ft boat under the Tay road and rail bridges in the city. The pilot, Barry Nisbet, called harbour officials, who notified police.
The first mate took the wheel of the ship while Borodins retired to his bunk to sleep off his intoxication.
Fiscal depute Eilidh Robertson told Dundee Sheriff Court that Borodins and his three crew had intended to sail the vessel - used to transport animal feed and registered in the Bahamas - from Perth to Norway when the incident occurred on July 28 .
Ms Robertson said: "The vessel made its way from Perth and at around 7.40pm, in the area of Balmerino, Barry Nesbit, a pilot from Dundee harbour, came aboard. He was to guide the vessel through the shipping lanes at the Tay bridges.
"He introduced himself to the accused and became concerned regarding his demeanour.
"Mr Nisbet gave the accused instructions in how to get the vessel through the shipping lanes and noted [Borodins] was unable to carry out instructions and was unsteady on his feet.
"He formed the impression that the accused was under the influence of something and contacted Dundee Port Authority, who notified police."
Police officers attended the harbour after the ship had docked and found the accused asleep in his bunk, she said.
"The accused failed a breath test and was removed from the vessel and taken to police HQ," she said. "He later told police when charged that he 'arrived at the port sober and had a drink in the port'."
The ship set sail for Norway without Borodins two days after he was arrested.
Borodins, 53, an inmate at HMP Perth, pleaded guilty on indictment to a charge under the Railways and Transport Safety Act 2003.
Defence solicitor John Kydd said Borodins had been at sea for 25 years having previously carried out his national service in the Russian military.
He said: "It is lucky for him that the pilot did what he did otherwise there could have been a disaster - there could have been an accident.
"The pilot took the correct decision to challenge that captain and send him to his bunk and take control of the ship.
"He was exhausted from doing back-to-back six-hour shifts and that was his reason for drinking.
"He says he doesn't normally drink much - he says this was abnormal for him. He spends his time at home with his family, and when he's at sea his time off is spent visiting the great battlefields of World War II and doing archaeological digs."
Sheriff Alastair Brown jailed Borodins for four months --reduced from six for his early guilty plea.
He said: "The law is concerned with safety, as the title of the act you were prosecuted under makes clear. The pilot has his or her own responsibilities but ultimately the master of the vessel is responsible for the safety of the vessel.
"This charge is not equivalent to drink-driving.
"You put yourself in a condition where you were unable to discharge your responsibilities as master of the vessel. I regard that as very serious - it is a gross breach of your duty."