the problem is the loading time. you can use docker in theory but even they have problem in spawning to many parallel instances.
I would use a small node server in a docker instance which basically just executes all commands the user types in the container
so it's isolated and you could in theory spawn instances on demand.