Were the methods used by the United States to contain communism justified?
Whether the methods employed over the course of the Cold War could be justified by either the moral and legal standards of the time or by more contemporary standards is somewhat subjective. Certainly, some of the covert actions undertaken ostensibly to contain Soviet and communist aggression or expansionism crossed boundaries that the standards of then and now both suggest were less than appropriate. From Central America to Africa to Asia, the Cold War struggle between the United States and its allies and supporters on one side and the Soviet Union and its satellite nations and supporters on the other invariably drew into the conflict many less-developed nations that suffered from the effects of their own internal conflicts exacerbated by the interventions of the U.S. and the U.S.S.R. Some of those interventions, assuming one discards the notion of moral equivalency between West and East, were entirely justified. Such was the case with Nicaragua, where a legitimate revolution against the Somoza dynasty was subverted by the Marxist-Leninist Sandinista movement that imposed a more totalitarian system on the country than the right-wing one it replaced.
The most morally questionable actions undertaken by the United States in the name of containing communism involved large-scale and highly destructive military interventions in Southeast Asia and in Africa. One can legitimately argue for or against U.S. involvement in Vietnam following the defeat of Imperial Japan and efforts by France to reimpose its control over its former colonies in what was called Indochina. The loss of hundreds of thousands of lives, 58,000 of which were U.S. military personnel, in a conflict fought with uncertain commitment and high levels of ignorance of the cultures and histories in which we became engaged hardly speaks well of U.S. efforts there. Whether the actions were justified given the level of effort and blood and treasure expended will be debated forever, but given the repressive measures undertaken by communist regimes to enforce their will upon their own populations, including in Vietnam following the fall of Saigon, the American role in Southeast Asia can be considered justified.
Covert actions in Europe (especially in Italy and Greece in the years immediately following the end of World War II) definitely left the most dubious record of all U.S. actions during the Cold War. Some worked and others did not, but all left behind legacies that exemplified the absence of clarity with regard to moral and geopolitical imperatives. Two covert actions that boasted short-term gains with long-term ramifications we could do without took place in Iran (1953) and Guatemala (1954). The latter in particular, exercised as much for economic as for geopolitical reasons, created a sad legacy of human rights abuses and systemic corruption.
On the plus side, the United States was instrumental in using nation-building in the post-World War II world to contain communism while strengthening itself. This nation-building was responsible for the establishment of enduring democratic political systems across Western Europe and in Japan. It was no accident that countries under the U.S. protectorate like West Germany and Japan became economic powerhouses while maintaining liberal democratic systems, while countries under Soviet control, such as East Germany, Poland, and its Vietnamese allies, all endured decades of anemic economic growth and populations increasingly starved for the basic freedoms enjoyed by American allies. Comparing Thailand to Vietnam and Laos, or North Korea to South Korea, or East Germany to West Germany, leads to the conclusion that American efforts at containing communism and Soviet aggression created a net good for much of the world. The negatives--Guatemala, Angola--tragic though those cases were, are outweighed by the positives: a Europe free from major conflict for many decades.
The US used so many different methods in so many different places, that it is practically impossible to generalize. I would argue that some of the methods used by the US were completely justified while others were not.
An example of a completely justified method was the Marshall Plan. The Marshall Plan sought to contain communism in Europe by helping Western European countries rebuild their economies after WWII. The threat of Soviet expansion was real and the method used to contain it was peaceful and benign. In this instance, then, US methods were completely justified.
However, other methods were much less clearly justified. An example of this might be the overthrow of Mohammed Mossadeq in Iran. Mossadeq was not clearly a communist, so it is not clear that he was a real threat. The method used to contain his (alleged) communism was one which led to the creation of a repressive government. This is much less clearly justified.
Overall, then, US actions must be examined on a case-by-case basis to determine which were justified.