When I travel for work, I take my own detergent (sensitive skin). I use powdered detergent, so I just pour some into a small plastic container (usually an old cake frosting container). I put that container into a quart size ziploc bag along with a 1/8 cup measuring cup (I know that about two of those does one load of laundry.) along with a few fabric softener sheets. Then I toss that into my suitcase (you could wrap it in a t-shirt, if you wanted some padding around it, but I've never had any problems. Even if the plastic container busts, it's in a ziploc (I use the freezer bags, so they're thicker) and that should hold it.
If you want to use liquid, I suggest getting some sort of leak proof plastic bottle would work. A small Nalgene bottle is what I would recommend. I got a few 4 oz bottles a while back and they've never leaked a bit, regardless of what I've put in them or what I've put them through. Good outdoors/camping stores should have them. Or you could use travel bottles meant for shampoo, although I haven't had as good luck getting those not to leak.