If I understood your requirement correctly, you may be interested in excontainers, a library I developed to tackle exactly this problem.
Unfortunately it has not seen much adoption yet, but in case you decide to give it a try I’d be happy to hear about any problem you may encounter or any feedback you may have