Al-Shabab militant group claimed responsibility for the attack.
A suicide truck bomb hit the entrance of Somalia's biggest port on Sunday, killing 29 people and injuring 50, police said.
The Al-Qaeda aligned Al-Shabab militant group claimed responsibility for the attack. They said they were trying to disrupt protracted parliamentary elections. The three-month vote is due to end on December 29.
"Some people are missing and so the death toll may rise," a policeman Major Abdullahi Ali said.
Witnesses said the bodies of four victims were seen strewn outside the facility, in a street filled with rubble from damaged tea shops.
Mohamed Hussein, a port employee, said gunfire had followed the blast. Another port official, who did not want to be named, said activity at the port has been halted.
Al-Shabab is fighting to overthrow the internationally-backed government of Somalia and regularly stages deadly attacks on government, military and civilian targets in the capital and elsewhere in the war-torn country.
Al Shabab's insurgency aims to drive out African Union peacekeepers, topple Somalia's western-backed government and impose its strict version of Islam on the Horn of Africa state.
Around 14,000 people representing Somalia's federal states have been chosen to pick the 275 lawmakers. Those members of parliament will choose a new president.