The military later deployed fighter jets to put an end to the assault on the camp on the outskirts of Bama town.
Families of soldiers inside the barracks and Bama residents say women and children are among the dead.
This is the second serious attack on the military this month in a region which is under emergency law.
For several years, militants from the Boko Haram group have been fighting an insurgency in the mainly Muslim area to impose strict Islamic law in northern Nigeria.
It is not the first time that Bama, which is about 40km (25 miles) south-east of the Borno state capital, Maiduguri, has been attacked.
In May, Boko Haram fighters raided the town's barracks, police station and government buildings, killing more than 50 people and freeing 105 prisoners.
A week later the government declared a state of emergency in Borno and two neighbouring states, Adamawa and Yobe.
A Bama resident told the BBC Hausa service that the attack began at about 03:00 local time (02:00 GMT) on Friday and gunfire and explosions were heard.
The aerial bombardment began at about 06:00 and the fighting died down about an hour later, he said.
Several residents told the AFP news agency that the insurgents had swarmed the barracks in a convoy of 4x4 trucks, armed with assault rifles, explosives and rocket-propelled-grenades.
The BBC's Will Ross in Nigeria says that despite claims of success by Nigerian officials, it is clear that the Islamist fighters still pose a considerable threat to the stability of the country.
Earlier this month, Boko Haram launched co-ordinated attacks on Maiduguri's air base and other military barracks that left buildings as well as aircraft destroyed.
The UN said this week that more than 1,200 people had been killed in Islamist-related violence in north-east since the state of emergency was declared.
Suspected Islamist militants have attacked a military barracks in north-eastern Nigeria in a fierce battle that lasted for several hours.