In the movie, Thirteen Ghosts it was shown that ghosts can be captured in glass rooms. But how were they trapped there in the first place?
The only answer I could find was for the Juggernaut.
If you mean how they are captured in general, then the beginning of the movie, which shows how they capture the Juggernaut at a junkyard, answers this perfectly. If you ask how all the others got captured in particular, then this cannot be answered since it isn't explained in the movie at all.
But you can assume that the overall process was similar to the shown one: Cyrus and a team of specialists, one of them Dennis the psychic, hunted them and trapped them into one of those glass containers they ended up in (though for some of those ghost it was probably much easier than this action-packed junkyard scene where many of Cyrus's team die). In fact that's one of the purposes of this first scene, showing how they captured those ghosts (even if the audience only learns about the actual meaning of this and all those characters later on).