Flies are typically kept in plastic or glass containers. I strongly recommend polypropylene plastic vials. Glass containers seem to suffer from condensation to a much greater extent. This can prevent the media from adhering to the vial (allowing it to slip when the vial is inverted), and prevent flies from climbing up the side of the vial.
Re-useability is something that we should all aim for, however fruit fly vials get SO 'glued-on' that it is often very messy and time consuming to clean them effectively, and fly keepers often use disposable cups. However, polypropylene plastic vials with straight sides really are the best choice. The media stays in place better, and if soaked and washed with a bottle brush, can be cleaned and reused easily. Conical flasks are just that bit harder to clean. Such containers are somewhat hard to source, but are available from scientific suppliers online.
Vials can be sealed with sponge (you can make your own - though they are somewhat difficult to cut perfectly; but again available online from scientific suppliers), these are good at keeping out mites, and very convenient. Less good options include: cotton wool (cheap, easy, but only good for vials with small openings. Not reuseable.), filter paper (can be damaged when wet) or netting (cheap, reuseable, can allow mites and interbreeding with wild flies). If you use netting, it is best to keep the flies in a cabinet to keep out other flies.
Under laboratory conditions flies need to be moved from container to container without any escape. This is performed by anaesthetising the flies with CO2 or ether. This renders them unconscious for a minute or two without damage. Even fully flighted flies can be easily managed in this way. If you have a cylinder of CO2 handy, perhaps for a planted aquarium, try inverting the vial, and introducing a gentle flow of CO2 by inserting a fine tube past the sponge topper. After just a few seconds the flies will fall unconscious. This is where the consistency of the media is essential. If your flies are kept over sloppy media, when it is inverted, media will slide down the side of the container, sticking to flies and potentially falling out. If you use the Sussex miedia (see fruit fly food recipes) it will stay exactly where it should! Tap the container a couple times, and all the sleeping flies will all fall out. No mess, just flies.
Luckily flightless flies are relatively easy to manipulate without CO2, as long as you work quickly. If you have difficulties, 5-8 minutes in a freezer greatly reduces their mobility. But work quickly, because they will wake up soon!
Always use funnels when moving flies from one vial to another. This will largely prevent escape, and allows a vial to be left 'unlidded' with flies still in it. If any do start to walk back up, a gentle tap soon sends them back to their food!
$5
$11
$10
$10
$11