A brigade commander was among the dead in the attack, which took place in the Abu Ghraib area, the sources said.
The deaths came two days after five senior officers, including a division commander, and 10 soldiers were killed during an operation against militants in the western province of Anbar.
Violence in Iraq has reached a level not seen since 2008, when the country was just emerging from a brutal period of sectarian killings. (AFP)