Most of the 500 demonstrators were dispersed peacefully, but police shot the projectiles at two gates when protesters refused to move and some of them allegedly threw rocks and bolts. The longshoremen, pinned against a fence, were caught in the line of fire.
Police spokeswoman Danielle Ashford said officers fired bean-bag rounds and wooden dowels. They also used "sting balls," which send out a spray of BB-sized rubber pellets and a cloud of tear gas and feel like a bee sting when they hit someone.
Demonstrators said they targeted the port because at least one company there is handling war supplies. They said it was the first time they had been fired upon in Bay area protests since the Iraq war began last month.
"Oakland police are being the most aggressive of any department I've seen in the Bay area since the war began," said protester Damien McAnany, a database manager. "The San Francisco Police Department never used any of this stuff against us."
About 200 of the port demonstrators later marched to the federal building in Oakland, blocking a street and chanting: "Out of the office and into the streets! U.S. out of the Middle East!" They were joined by Oakland City Council members Jane Bruner and Jean Quan.
"They should not have been using the wooden bullets," Bruner said. "Given what's happening in the world today, we're going to be seeing more of this. And we should be prepared to handle it."
Oakland Police said at least 31 people were arrested.
"Some people were blocking port property and the port authorities asked us to move them off," said Deputy Police Chief Patrick Haw. "Police moved aggressively against crowds because some people threw rocks and big iron bolts at officers."
Nevertheless, Police Chief Richard Word said the department would evaluate the officers' tactics. The dowels are supposed to be shot at the ground and carom up to strike their target, Word said, but some of the injured complained that officers took direct aim at them.
Mayor Jerry Brown said police were right in trying to keep order. He blamed the melee on a handful of protesters.
"When a guy picks up a bolt and throws it at a policeman, he's setting in motion a chain of events," Brown said.
Six longshoremen were treated by paramedics, some of whom had bloody welts the size of a silver dollar.
"I was standing as far back as I could," said longshoremen Kevin Wilson. "It was very scary. All of that force wasn't necessary."
Steve Stallone, spokesman for the International Longshore and Warehouse Union, said most of the dockworkers went back to work after the protesters left. A few were too shaken up to return.
Protests also took place Monday at the federal building in San Francisco and at the Concord Naval Weapons Station. And seven people were arrested when they temporarily blocked an exit ramp off Interstate 280 in San Francisco.