The Cosserat director theory is used to formulate the problem of a long thin weightless rod constrained, by suitable distributed forces, to lie on a cylinder while being held by end tension and twisting moment. Applications of this problem are found, for instance, in the buckling of drill strings inside a cylindrical hole. In the case of a rod of isotropic cross‐section the equilibrium equations can be reduced to those of a one‐degree‐of‐freedom oscillator in terms of the angle that the local tangent to the rod makes with the axis of the cylinder. Depending on the radius of the cylinder and the applied load, the oscillator has several fixed points, each of which corresponds to a different helical solution of the rod. More complicated shapes are also possible, and special attention is given to localized configurations described by homoclinic orbits of the oscillator. Heteroclinic saddle connections are found to play an important role in the post‐buckling behaviour by defining critical loads at which a straight rod may coil up into a helix.