A search for quark compositeness in the form of quark contact interactions, based on hadronic jet pairs (dijets) produced in proton-proton collisions at √s=7 TeV, is described. The data sample of the study corresponds to an integrated luminosity of 2.9 pb-1 collected with the CMS detector at the LHC. The dijet centrality ratio, which quantifies the angular distribution of the dijets, is measured as a function of the invariant mass of the dijet system and is found to agree with the predictions of the standard model. A statistical analysis of the data provides a lower limit on the energy scale of quark contact interactions. The sensitivity of the analysis is such that the expected limit is 2.9 TeV; because the observed value of the centrality ratio at high invariant mass is below the expectation, the observed limit is 4.0 TeV at the 95% confidence level.