The strategy of containment was, of course, based on the idea of hemming communism in where it already existed. Communism was not to be allowed to spread out of Eastern Europe. The Marshall Plan was a major early part of this strategy.
The purpose of the Marshall Plan was to rebuild Western Europe, making it prosperous once again. The idea was that a region that was no longer impoverished would not be inclined to become communist. The countries of the region would also, hopefully, be tied more closely to the US through the US's help.
In this way, the Marshall Plan was part of containment. It was meant to make it less likely that the people of Western Europe would want to embrace communism.
The Marshall Plan formulated under the Truman Doctrine aimed to provide economic assistance to European nations that were in the midst of post-war reconstruction. The Americans also sought to use the plan as an attempt to contain the spread of Soviet influence on the European continent, especially in Eastern Europe. This was achieved through the establishment of economic ties with the US, which in effect would break any bonds these states had with the USSR. In doing so, the US hoped to combat the appeal of communism (through the portrayals of economic success and prosperity under a capitalist system) and thus prevent the spread of communism.