The three-day summit begins on Wednesday.
Angela Merkel, the German chancellor, will lead discussions with leaders of Britain, France, Japan, Italy, Russia, Canada and the US on global warming, aid to Africa and the world economy.
The summit, like past ones, had been expected to attract protesters opposed to capitalism, globalisation, the war in Iraq and the G8 itself summit.
As part of the precautions for the summit, police have surrounded the site with a fence topped with barbed wire, and closed the surrounding waters and airspace, fearing terrorism.
German authorities are all too wary of past protests like the ones that marred a 2001 summit in Genoa, Italy - where police and protesters clashed for days and one demonstrator was killed.
Protests near the fence have been banned.
The huge protest in Rostock on Saturday had begun quietly, but a group of some 2,000 anti-G8 protesters hurled stones, bottles and Molotov cocktails at officers in riot gear.
Police then retaliated with tear gas and water cannons.
More than 400 officers were injured, 30 of whom were hospitalised with broken bones and lacerations, police said.
Protest organisers said 520 demonstrators were hurt, 20 of them seriously.
Authorities put the size of the demonstration at 25,000, while organisers said it was 80,000. Some 13,000 police were on hand.
Police said on Sunday that fewer than 20 people remained behind bars, and the public prosecutor's office in Rostock said it was seeking arrest warrants for 10 of them.
The 10 are accused of rioting and serious battery and expected to be sentenced next week, prosecutor Peter Lueckemann said.
On Sunday afternoon, about 1,500 people held a peaceful rally in Rostock against the Group of Eight's agricultural policies.