A suicide car bomb went off at the entrance of the facility in Taji at around 0600 local time (2300 EDT), allowing another vehicle carrying at least six attackers with explosive vests to enter the facility where they clashed with security forces, the sources said.
A spokesman for Baghdad Operations Command said three of the facility's gas storages were set alight amid the violence before security forces were able to bring the situation under control, Reuters reported.
A factory employee who lives nearby said after hearing a powerful blast he saw flames and black smoke coming from inside the factory.
Dozens of police and army vehicles rushed to the facility where shooting lasted for about an hour, he said.
There was no immediate claim of responsibility for the attack, but Daesh (ISIL) militants controlling vast swathes of the country's north and west have conducted bombings this week that killed around 100 people.
Iraq Prime Minister Haider al-Abadi said on Saturday the militants were taking advantage of a political crisis in the country, sparked by his attempt to overhaul its quota-based governing system, to conduct bombings in areas under nominal government control.Tasnim News Agency - world