Plastic jerricans are quite a popular way to transport stuff on the back racks.
It's not easy as it seems because the question goes with some constraints:
the system should not require special tools like a welding machine or a 3D printer. (Only basic stuff like a drill, saw, and maybe Dremel, heated gun…). The minimum of tools would be the best (something that could be done during bike travel would be great).
the jerrican can't be too close from the handlebars to let some room for the cables (break+speed). It needs to be placed at 10-15cm.
it needs to support at least 5 kilograms / 11 pounds.
the jerrican should be quickly removable (this doesn't necessarily apply to the system which attaches it).
the attach system should not damage the bike handlebars (eg. a piece of metal would rub/scrap it)
To answer some comments:
How do you intend on orienting this container It could either placed vertically (by cutting and removing the top) or on the side.
Is this a 5 Litre (small one) or a 20 Litre / 5 gallon (large one)? a 5-10L jerrican would be enough (I'm not sure if it's possible to drive safely with a 20L on the front, it looks quite dangerous, and 2 of them look great but it requires a proper front rack.
Why not using a full front rack. mostly because these racks aren't always easy to find in most parts of the world and because I like the simple robust solutions that recycle stuff.
why not using a basket-type solution?
Actually that's exactly what I'm looking for except that I want to use a jerrican as the basket, and I'm looking for a smart DIY way to attach/detach it to the handlebar.
Plastic jerricans are robust enough to support that load
A Screws piercing the jerrican maintained by bolts and washers are robust enough to support the weight.
a heat gun can bend some PE plastic (that could be used to fix it).
I'm also interested in other options to carry stuff on the front which doesn't involve fancy racks (but that would fit in another question, hopefully, someone already asked it).