The vessel was earlier cleared to sail by inspectors after running aground on a sandbank in the early hours.
Five tugs were sent to assist the 70,000-tonne liner at the entrance to Southampton Water.
It is thought gale force winds may have contributed to the incident.
About 1,700 passengers and 1,000 crew were on board. Many said they had felt the ship "shudder".
The ship was pulled off the sandbank after about 30 minutes, Solent Coastguard said. It later docked at 0730 GMT.
"The boat rocked. We thought it had hit something," said Gloria Dunkley, of Poole, Dorset, who was travelling with her husband.
"We were not too alarmed as no bells were rung."
Divers inspected whether the vessel was damaged when it hit the sandbank and the Maritime and Coastguard Agency sent two surveyors on board. The ship was later cleared to leave, Cunard said.
Now her sea days are done and she passes on to a new life in a new home. We wish her well
At 1100 GMT, one million poppies were dropped over the vessel by a DeHavilland Beaver aircraft accompanied by an Auster, to mark the 90th anniversary of the end of World War I and the start of a two-minute silence.
The Duke of Edinburgh went on board to meet crew members who travelled on the vessel when it was used as a troop ship in the Falklands War in 1982.
He was introduced to former captains of HMS Ardent, Antelope and Coventry - ships that were lost in the Falklands campaign.
He then joined other guests to watch an RAF Harrier jet, from No 1 (F) Squadron, hover over the ship for about one minute at 1345 GMT, before dipping its nose in tribute.
As well-wishers looked on from packed ferries in Southampton Water, RFA Mounts Bay led a flotilla of ships past the liner, blowing its horn as it went.
In a farewell address, Cpt Ian McNaught told the crowd the vessel had been acclaimed all over the world as a symbol of British excellence.
"For 40 years QE2 has striven to serve Southampton and serve her country with flair and fortitude," he said.
"But now her sea days are done and she passes on to a new life in a new home. We wish her well.
"On behalf of QE2 I bid Southampton farewell and thank you for all the affection you have shown to her in all these years.
"Southampton I salute you."
It was the Duke of Edinburgh seventh visit to the vessel, which was launched by the Queen at Clydebank, near Glasgow, in September 1967.
The liner has sailed nearly six million nautical miles, been round the world 25 times, crossed the Atlantic more than 800 times and carried more than 2.5 million passengers.
Send us your pictures of the QE2 to yourpics@bbc.co.uk, text them to 61124 or if you have a large file you can upload here.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.
Bookmark with:
What are these?