I want to make dulce de leche by boiling it. As the storebrought cans leach plastics like BPA into the food, I want to avoid using it. What are jars/cans, preferably reusable what you can put inside some food, close it and boil for several hours which so happens to be made from safe for humans material?
You can make dulce de leche by simply cooking ingredients in a pan on the stove top. Alton Brown has a good recipe. It only takes 1.5 to 2 hours, and you don't have to worry about a container. This recipe begins with regular whole milk. There are similar recipes available from other sources. These recipes add baking soda to increase the pH and speed up the Maillard reaction.
However, from your question, I suspect that you might be beginning with sweetened condensed milk. Serious Eats simply puts the can (without opening) into a pot of water, where it is simmered for 2 to 3 hours.
If you want to remove the contents and use a mason jar (as @FuzzyChef suggests), I would fill close to the top, allowing a little head space, and tighten "finger tip tight". Pressure will build up in the jar (or the can). But the proper use of mason jars is important so that you avoid cracking. "Finger tip tight" means to tighten the ring gently, that back off slightly. If you use the can, at least according to the Serious Eats recipe, you should have no issues.
By the way, the Serious Eats recipe that uses a can only takes 2 to 3 hours. Seven hours seems like a long time. I think your end product will be quite dark by then, but maybe that is your goal.
This is exactly what Mason Jars are for. They're glass, so they can stand long periods of heat without leaching, and are designed to be boiled. Unlike a can, I'd suggest leaving the lid secured loosely so that it can bleed off pressure.