One of the basic characteristics of a linear dsDNA molecule is its persistence length, typically of order 50 nm. The DNA chain inflicts a large energy penalty if it is bent sharply at that length scale. Viruses of bacteria, known as bacteriophages, typically have a dimension of a few tens of nanometers. Yet, it is known that a bacteriophage actively packages viral DNA inside the capsid and ejects it afterwards. Here, adopting a commonly used polymer model known as the wormlike chain, we answer an idealized question: Placing a linear DNA molecule inside a spherical cavity, what ordered states can we derive from known tools in statistical physics? Solving the model in a rigorous field-theory framework, we report a universal phase diagram for four orientationally ordered and disordered states, in terms of two relevant physical parameters.