Gunfire and heavy explosions shook the military barracks at Akuedo, located in north-eastern Abidjan, for about an hour before a tense calm returned to the area.
The country’s armed forces chief General Phillipe Mangou went on state television afterward to reassure nervous residents, saying military forces had repulsed the attack.
An Associated Press reporter on the scene saw four bodies at the two camps - one soldier and three young men in civilian clothes whom security forces said were among the assailants.
There was no word on who carried out the assault, the first since a new national unity government took office last week to help steer Ivory Coast toward delayed elections due later this year.
Country split
Ivory Coast, the world's top cocoa producer, has been split between a rebel-held north and a loyalist south since a failed 2002 coup in Abidjan sparked days of fighting in the city.
General Mangou called on residents living near Akuedo to remain indoors while security forces conducted a search for the assailants, some of whom he said had fled in civilian clothes.
"I wanted to reassure the population and tell them the situation is under control," General Mangou said.
"Our elements effectively control Camp Akuedo."
The camps are separated by a highway, and the newer one is home to heavy armaments and a tank battalion.
Elsewhere in the city, paramilitary police set up roadblocks on main roads, turning back the few cars that ventured out.
Streets were deserted as a result, and tanks could be seen deployed protectively around the national television station.
French peacekeepers sent helicopters into the skies above Akuedo.
There has been no official announcement on casualties.
The body of one soldier could be seen just inside the gate of one of the camps, covered by a sheet.
A soldier said three of his comrades were killed altogether, but that could not be confirmed.
Nearby, the body of a man in dark clothes lay on a main highway, and soldiers said he was an assailant who commandeered a military vehicle and fired at them, prompting a hail of return fire that ripped apart the front end of the vehicle and melted its frame.
Two other bodies in civilian clothing could be seen outside the camps.
Two of the attackers were captured alive by security forces. They sat in the sun, both shirtless and bloodied.
On December 1, authorities repelled another brief attack on a paramilitary police camp in Abidjan.
Authorities have not named the suspected attackers.
Tensions high
The latest violence is sure to raise tensions in the country, which has been on edge since President Laurent Gbagbo cancelled planned October elections, blaming the war and rebels' failure to disarm.
Afterward, the United Nations and the African Union endorsed a one-year extension of Mr Gbagbo's five-year mandate, which rebels and opposition leaders have fiercely opposed.
Last week, a new 32-member national-unity government composed of rebel, opposition-party and ruling-party ministers took office.
A new prime minister, Charles Konan Banny, was chosen by the warring sides to arrange the new Cabinet.
Rebel leader Guillaume Soro was named minister of reconstruction, while Gbagbo loyalists and foes were among the new ministers.
About 10,000 peacekeepers, both French and United Nations forces, are deployed in the country.
