We formulate and prove a very general relative version of the Dobrushin-Lanford-Ruelle theorem which gives conditions on constraints of configuration spaces over a finite alphabet such that for every absolutely summable relative interaction, every translation-invariant relative Gibbs measure is a relative equilibrium measure and vice versa. Neither implication is true without some assumption on the space of configurations. We note that the usual finite type condition can be relaxed to a much more general class of constraints. By relative we mean that both the interaction and the set of allowed configurations are determined by a random environment. The result includes many special cases that are well known. We give several applications including (1) Gibbsian properties of measures that maximize pressure among all those that project to a given measure via a topological factor map from one symbolic system to another; (2) Gibbsian properties of equilibrium measures for group shifts defined on arbitrary countable amenable groups; (3) A Gibbsian characterization of equilibrium measures in terms of equilibrium condition on lattice slices rather than on finite sets; (4) A relative extension of a theorem of Meyerovitch, who proved a version of the Lanford--Ruelle theorem which shows that every equilibrium measure on an arbitrary subshift satisfies a Gibbsian property on interchangeable patterns.