Riot police were deployed after up to 100 people breached security and tried to run up the ramp of the cross-Channel ferry.
Migrants were foiled from getting on board the MyFerryLink-operated Berlioz vessel when the crew raised the ramp and turned a fire hose on them on Wednesday, officials and a witness said. A MyFerryLink spokesman said: "MyFerryLink can confirm that an incident took place in Calais, whereby several migrants entered the port and attempted to board the MyFerryLink Berlioz.
"The crew took immediate action to ensure the ship's security and the attempt was unsuccessful."
A spokesman for ferry operator P&O, whose vessel Spirit Of Britain was not stormed, said: "We approached the port and witnessed the migrants. Our crew remained in the inner harbour and didn't tie up until we were able to do so."
One passenger, John Bailey, said he saw a large crowd of migrants on the main access road being guarded by French police, some armed with sub-machine guns.
A UK Border Force spokesman said the ramps on the vessel were immediately raised when a number of migrants entered the port, and none was able to board.
He added: "All freight vehicles inside the port at the time have been rescreened by Border Force."