A "contact network" that models infection transmission comprises nodes (or individuals) that are linked when they are in contact and can potentially transmit an infection. Through analysis and simulation, we studied the influence of the distribution of the number of contacts per node, defined as degree, on infection spreading and its control by vaccination. Three random contact networks of various degree distributions were examined. In a scale-free network, the frequency of high-degree nodes decreases as the power of the degree (the case of the third power is studied here); the decrease is exponential in an exponential network, whereas all nodes have the same degree in a constant network. Aiming for containment at a very early stage of an epidemic, we measured the sustainability of a specific network under a vaccination strategy by employing the critical transmissibility larger than which the epidemic would occur. We examined three vaccination strategies: mass, ring, and acquaintance. Irrespective of the networks, mass preventive vaccination increased the critical transmissibility inversely proportional to the unvaccinated rate of the population. Ring post-outbreak vaccination increased the critical transmissibility inversely proportional to the unvaccinated rate, which is the rate confined to the targeted ring comprising the neighbors of an infected node; however, the total number of vaccinated nodes could mostly be fewer than 100 nodes at the critical transmissibility. In combination, mass and ring vaccinations decreased the pathogen's "effective" transmissibility each by the factor of the unvaccinated rate. The amount of vaccination used in acquaintance preventive vaccination was lesser than the mass vaccination, particularly under a highly heterogeneous degree distribution; however, it was not as less as that used in ring vaccination. Consequently, our results yielded a quantitative assessment of the amount of vaccination necessary for infection containment, which is universally applicable to contact networks of various degree distributions.