America wanted not just to contain communism - they also wanted to prevent the domino effect. Truman was worried that if Korea fell, the next country to fall would be Japan, which was very important for American trade. This was probably the most important reason for America's involvement in the war.
World War I is an example of the way wars tend to lose popular support after many years and mounting causalities. By 1917, the European public began to denounce the war and call for peace. Many soldiers, too, lost their resolve and deserted.