The rockets were fired from a Shiite-dominated neighborhood in eastern Baghdad, said police officials who spoke on condition of anonymity because they were not authorized to speak to the media.
The Pentagon chief was visiting the U.S. military's Camp Victory on the capital's western outskirts at the time of the attack on the Green Zone, the heavily secured district in central Baghdad that is home to the U.S. and other embassies as well as Iraqi government offices.
Panetta, a former CIA director, was in Baghdad for the first time since becoming defense secretary.
He was to meet with Iraqi leaders to discuss the possibility of keeping some U.S. troops in Iraq beyond 2011. He was also expected to press Iraq for stronger action to stop stepped-up attacks on U.S. forces, especially from Shiite militia groups using Iranian-supplied weapons.