At least 20 US soldiers were wounded in the fighting, which lasted about an hour, a US officer said. At least 12 detainees were also wounded, some severely.
It was not known how many fighters were wounded or killed.
"A group of between 40 and 60 insurgents attacked the US forward operating base at Abu Ghraib," Lieutenant Colonel Guy Rudisill, spokesman for detainee affairs, said, adding the attack began about 11am (1500 GMT).
"They detonated two VBIEDs [vehicle-borne improvised explosive devise] and also fired rocket-propelled grenades into the prison camp. It was a sustained attack," he said.
US forces responded with heavy weapons, and the situation was under control by 3pm, Rudisill said.
"The attacks were intermittent. They would fire RPGs and then stop, then they would attack again," he said. "It is under control now."
Witnesses said the second car bomb was detonated against US forces as they were evacuating casualties from the first car bomb blast.
Rudisill said US troops had sealed the prison grounds and it was not thought that any fighters had penetrated the jail's perimeter.
Abu Ghraib, notorious for the prisoner abuse scandal that emerged last year, is on the western outskirts of Baghdad. It is one of three US-run detention facilities in the country.