The fire was brought under control Friday morning, firefighter Abdur Rashid said.
The Bangladesh Garment Manufacturers and Exporters Association, which represents factory owners, pledged to provide financial help to the families of the dead and pay for the treatment of the injured.
All of the bodies of the dead were sent to their villages for burial, the association said.
Bangladesh has about 4,000 textile factories, and many of them are unsafe, labor rights groups say. The sector employs about 2 million workers, mostly women.
The industry annually earns $10 billion from exports, mainly to the United States and Europe.