The packaging of double-stranded DNA into bacteriophages leads to the arrangement of the genetic material into highly-packed and ordered structures. Although modern experimental techniques reveal the most probable location of DNA inside viral capsids, the individual conformations of DNA are yet to be determined. In the current study we present the results of molecular dynamics simulations of the DNA packaging into several bacteriophages performed within the framework of a coarse-grained model. The final DNA conformations depend on the size and shape of the capsid, as well as the size of the protein portal, if any. In particular, isometric capsids with small or absent portals tend to form concentric spools, whereas the presence of a large portal favors coaxial spooling; slightly and highly elongated capsids result in folded and twisted toroidal conformations, respectively. The results of the simulations also suggest that the predominant factor in defining the global DNA arrangement inside bacteriophages is the minimization of the bending stress upon packaging.