Molybdenum disulfide (MoS2) is a promising candidate for 2D nanoelectronic devices, which shows a direct band-gap for monolayer structure. In this work we study the electronic structure of MoS2 upon both compressive and tensile strains with first-principles density-functional calculations for different number of layers. The results show that the band-gap can be engineered for experimentally attainable strains (i.e., ±0.15). However, compressive strain can result in bucking that can prevent the use of large compressive strain. We then studied the stability of the compression, calculating the critical strain that results in the on-set of buckling for free-standing nanoribbons of different lengths. The results demonstrate that short structures, or few-layer MoS2, show semi-conductor to metal transition upon compressive strain without bucking.