Or would it just suck in whatever was attempting to contain it? I for the life of me can't figure out an explanation for it. Could we even create a singularity in the lab or would it be too dangerous?
Believe it or not, but depending on the size of your singularity, the real issue might be sustaining it, not containing it. Hawking radiation tells us that black holes will dissipate slowly, and once they reach a critical size, will dissipate faster, especially if not being 'fed' with more mass.
This is not to say that they wouldn't be dangerous. The problem with containing an artificial singularity is that we just don't understand gravity enough to prevent the gravitational influence of the singularity from 'leaking' out of the containment system, whatever that would look like. That's assuming that the mass of a black hole alone without gravity doesn't cause other issues, say with our planetary momentum. It's not as simple as a powerful magnetic field (like in Romulan Warbirds) because we haven't integrated EM field theory with gravity yet.
When Maxwell integrated the theories of electricity and magnetism, it led to a massive growth in technology that hadn't been possible previously. Physicists are currently trying to integrate EM theory with weak nuclear forces. That would lead to another massive growth in our technological capability and understanding of the universe. Next would likely come Strong nuclear forces, and Gravity is likely going to be the last fundamental force to be integrated into a Unified Theory of the universe, primarily because it's so exotic by comparison to the others.
Until then, I'd be giving the creation of black holes a bit of a miss. They're just too dangerous and we don't fully understand them, even though we know a lot more than we used to.
Let's take an example from piezoelectricity. Piezoelectricity is the generation of electricity from pressure. Simplistically, you stand on a piezoelectric plate and a light bulb turns on due to the elecricty generated by your mass applied to the plate.
Let's assume we can create some form of unobtainium that is both piezoelectric and indestructable. An artificial singularity could be created and stuffed inside said globe. Because our globe is perfectly round1 and we were able to place the singularity at precisely the center, the result is a singularity that is pulling in on the globe uniformly and therefore won't move.
The globe, of course, has an electrode connected to the inside of the globe passing though an equally indestructable but perfectly insulating insulator to a point ouside the globe. A second electrode is connected to the outside of the sphere. This gives us plus and minus voltage references.
Depending on how much the globe is allowed to compress, you now have an abundant source of electricty until the singularity dissipates (or until some idiot bumps the globe, allowing the singularity to go off-balance, sucking in the mass of the globe, the planet, and finally the moon, leaving the sun to become a binary star. It's all very dramatic. Let's call that idiot "Harold." No offense to any Harolds reading this answer.)
A fundamental problem is keeping the singularity in one place. Equally pulling is not as convenient as equally pushing. Equally pushing means you could move the globe (within limits) and the singularity would stay in place... but it pulls. Equally pulling means once you've figured out how to keep the two synchronously in place, you can't touch it. We can come up with all kinds of handwavium solutions to drawing energy from the singularity—but now you have two real problems to overcome. From the other answers: sustaining the singularity. From mine: keeping it in place.
1 A good "family man" approaches a physicist with a "request" for a formula that will guarantee consistent wins at the racetrack. The physicist, well motivated, works diligently and provides this good family man an answer. "I guarantee it will work every time!" the physicist proudly (if nervously) proclaims. "It haz betteh..." warns the man. Later that day the now very angry family man returns and tells the physicist that the formula didn't work. "I lost every bet!" the man screamed. "I don't understand!" cried the physicist. "It worked with the spherical horse!"
The important part about a singularity is that it has infinite density, not the amount of mass. According to wikipedia you can have a black hole at any size above the plank mass. Which means that it would exert the exact same amount of gravitational influence as any other mass of the same size. Like the other answer suggests, the main difficulty would be in sustaining it, not in keeping everything from being sucked in.
A visit to WolframAlpha using a statistic from the above wikipedia page shows us that in regular 3 dimensional gravity the minimum mass of a black hole would be 18 µg, which is certainly not about to suck the moon out of orbit. Furthermore, the Schwartzschild radius of this black hole is only 2.673×10^-35 meters. This would be pretty easy to maintain as long as we can keep it in a vacuum. Indeed, we're probably even safe outside a vacuum, as air molecules at STP [are more than 10 orders of magnitude farther apart than the Schwarzschild radius.
Additionally, I think it's important to think about conservation of mass and energy. If we're going to create a black hole big enough to pull the moon in to the earth, that energy has to come from somewhere, and that somewhere will have to be on earth for at least a short period. That energy will already cause the moon to be pulled in because, again, the only difference between a 5kg black hole and a 5kg bowling ball is that one is smaller in radius than the other. Outside the Schwartzschild radius there's really no physical difference.