We study the superconductor-insulator quantum phase transition in disordered Josephson-junction chains. To this end, we derive the field theory from the lattice model that describes a chain of superconducting islands with a capacitive coupling to the ground (C0) as well as between the islands (C1). We analyze the theory in the short-range (C1≪C0 ) and in the long-range (C1≫C0 ) limits. The transition to the insulating state is driven by the proliferation of quantum phase slips. The most important source of disorder originates from trapped charges in the substrate that suppress the coherence of phase slips, thus favoring superconducting correlations. Using the renormalization-group approach, we determine the phase diagram and evaluate the temperature dependence of the dc conductivity and system-size dependence of the resistance around the superconductor-insulator transition. These dependences have in general strongly nonmonotonic character, with several distinct regimes reflecting an intricate interplay of superconductivity and disorder.