The dockers, from across the EU, had converged on Strasbourg to protest at controversial proposals to open up port services to greater competition.
The EU's Port Package II proposals will be debated in Strasbourg on Tuesday, with a vote expected on Wednesday.
The dockers fear they could lose their jobs if port services are liberalised - as the proposals recommend - allowing private contractors or ships' crews to unload freight, for example, or to pilot ships into port.
The European Parliament rejected a similar bill three years ago and analysts say MEPs are expected to do so again this week.
Around 6,000 protesters are reported to have joined the march in Strasbourg although police said only a few hundred turned violent.
The BBC's Alix Kroeger, at the European Parliament building, said it was a strong confrontation between police and protesters.
She said the dockers beat drums and chanted slogans, then began throwing stones, firecrackers and canisters that gave off clouds of coloured smoke. The police fired tear gas and water cannon.
At least 13 dockers were arrested and 12 policemen injured. A parliament spokesman said the protests had caused "considerable damage", running into hundreds of thousands of euros.
Belgian docker Christian Lubpen said he was protesting as greater competition would mean more cheap foreign labour being brought into the docks to save costs.
"We go to school to learn our job and it's a dangerous job too - we work with tall cranes," he said. "And now, to reduce the costs, they want to take people from other countries and we don't want that."
MEP Alyn Smyth, who watched the violence from his seventh floor office in the parliament building, criticised the dockers "for picking a fight with the one EU institution which will help them".
"I condemn the actions of a minority of these dock workers," he said. "The majority were protesting peacefully, as is their right, but a fair number were up for a fight and they came prepared with rockets, distress flares and other fireworks."
Among the main ports affected by the strike action are Rotterdam in the Netherlands, Antwerp in Belgium and Le Havre in France.
Pascal Galeote, deputy head of Marseille port's branch of the CGT union, said: "The commercial activities of the Autonomous Port of Marseille (PAM), in Marseille and Fos-sur-Mer, are completely stopped.
"All activities - handling, operating, naval repairs and oil are blocked."
Michel Delebarre, the mayor of Dunkirk who also represents the town in parliament, said: "The [EU] directive opens ports up to the most absurd free market ideology. A port isn't a self-service where each ship turns up with its own rules."
In Belgium, a union spokeswoman said: "The strike is total. Nothing is happening in Belgian ports."