To what extent was the containment of Communism successful in the years from 1950 to 1985?
Like any foreign policy that covers a period of time, there were successes and failure. Overall I believe containment was one of the more successful foreign policies we have ever exercised, but the Soviet Union had considerable resources at its disposal to challenge us, and we could not protect the world, simply put.
I believe in the time frame you mention that containment was quite successful in Europe, as communism did not expand into a single country outside of the original Soviet bloc in East Europe. It was also successful in Korea and Taiwan during that time period.
Vietnam, Laos and Cambodia all fell to revolutions during that same time, and the US was unable to prevent Cuba from going communist, or the Sandinistas from taking power in Nicaragua. Through assassination and espionage, Marxist-leaning governments in Guatemala and Chile were overthrown.
So it was a mixed bag of success, essentially.
Containment was a mixed bag at best., The doctrine, as defined by President Truman, was to contain, that is stop the spread of communism, which had promoted a world wide revolution. Containment did prevent West Germany from surrendering to the East and becoming part of the Communist Bloc; and also prevented Korea from becoming wholly Communist. However, it failed in Viet Nam as the country is now communist, despite the efforts of the United States to prevent it. Additionally, the Soviet Union invaded Hungary and Czechoslovakia and set up puppet governments there; and Fidel Castro declared himself a communist primarily to secure aid from the Soviet Union when the United States broke diplomatic relations. So, Communism did not spread as much as it might have otherwise (the Soviets anticipated a much larger sphere of influence;) yet it did not completely contain the expansion of Communism.
The answer to this depends to some extent on how you define success.
If success is defined as not letting any more countries become communist ("containing" communism where it was in 1950) you could argue that containment was not very successful. Two major examples of this would be the spread of communism into Southeast Asia (Vietnam, especially) and the Cuban Revolution led by Fidel Castro. America did not like either of these developments at all but could not stop them.
If, however, you define success more broadly, containment did work. The Soviet Union clearly did not manage to take over the world or even to seriously endanger the US's position as a superpower during those years. If the point of the policy was to maintain the US's power, then it clearly worked.