I think it worked because of out of the 196 countries of the world only 5 are communist. If we didn't try to contain it the domino effect would've happened and the whole world would be communist.
Before the united states tried to contain it over half of the worlds countries were communist. Now only 5 of them are communist because people realized the bad effects of communism and even the after effects are bad most countries that were communist now have corrupt governments.
As shown above in the pictures at first about half of the world was communist and now only 5 countries are communist. That's why I think containment of communism did work.