Whether Joab was commander-in-chief or one of several commanders of David's army at the time, the answer to the OP headline question is "no," Joab was not dismissed from his office when he killed Abner. The OP's secondary question - Why was David looking for a commander-in-chief if he already had Joab filling that position for years? - is a little trickier. The most likely explanation is that after Joab's treacherous murder of Abner, his reputation among the other captains suffered. David used the attack on Jerusalem to remove any objections to Joab's leadership.
David's reticence to punish Joab is considered a very serious problem by commentators such as John Schultz, who says:
Joab’s murder of Abner was premeditated and David ought to have
ordered Joab’s execution. The fact that he did not act according to
the Word of God at this time bound him to Joab for the rest of his
life. David must have thought that he would lose his whole army if
Joab were removed. But Joab’s murder of Abner could have cost David
all the tribes of Israel with the exception of Judah.
Some commentators (e.g. The Interpreters Bible 1-vol. Commentary) have even seen the episode as possibly pre-planned by David and Joab to allow David to be free from guilt in Abner's death since Joab could claim a blood-debt from Abner (2 Sam:2:23). In this scenario, David's public display of grief for Abner would be designed to assuage the feelings of the northern tribes, among whom Abner was well respected. The death of Abner left any question of a resurgent military threat from the House of Saul moot. Together with the victory at Jerusalem it would not be long until David united all 12 tribes under his leadership, with Joab as his strong right arm.
Whatever the reason and whatever office Joab held at the time, David did not dismiss Joab from his position for the crime. David gave Joab an opportunity to prove his worthiness as "commander-in-chief" through his successful attack on Jerusalem. Joab would prove to be both an important asset to David and a thorn in his side throughout his life.