India's navy chief held out little hope for survivors on a submarine after some of its weapons detonated accidentally and fire swept through it.

Eighteen sailors were on board the 16-year-old Russian-built INS Sindhurakshak, which was docked at the main naval base in Mumbai.

Two blasts rocked the vessel in the middle of last night.

Navy chief Admiral D.K. Joshi said divers had managed to pry open the main hatch of the diesel-powered submarine and were trying to find their way through the vessel.

"Whilst we hope for the best, we are prepared for the worst ... There is a possibility, however remote it could be, of an air pocket.

“There is a possibility, however remote it might be, of someone having grabbed a breathing set," he told a news conference.

The INS Sindhurakshak, which returned from an upgrade in Russia this year, had suffered an accident in 2010 in which one sailor was killed while it was docked in the southern port of Visakhapatnam.

Typically, such a submarine is fitted with torpedoes and missiles.

Photographs posted by social media users appeared to show a large fireball over the navy dock.

A navy source said one or two men were usually on duty on top of a berthed submarine, and those stationed on the Sindhurakshak either jumped into the water or were thrown off by the force of the blast.

The number of crew in the boat when fully operational is 110.

Another submarine in the Mumbai dock where vessels are usually tied to each other suffered minor damage, the naval source said.