Taxi driver James Boylan told gardai he had picked up a man outside a cafe bar at the junction of Mary Street and Jervis Street in the city centre on Monday night.
The passenger asked to be driven to Finglas in west Dublin where he was to meet a friend.
Mr Boylan said he was told to head for Cardiffsbridge Road, where he collected the second passenger, and was then directed to the Ballycoolin industrial estate in Blanchardstown.
When they reached the estate, Mr Boylan was ordered into a passenger seat by one of the men, who had produced a handgun, and his mobile phone was taken from him.
His black Toyota Avensis car was then driven to Dunsoghly Drive housing estate in Finglas where the two men jumped out of the vehicle and one of them opened fire, hitting Mr Boylan in both legs. The two attackers then made off on foot.
Gardai appealed to anyone with information to contact them at Finglas station, 01 6667500, or on the confidential phone line, 1800 666111.