Creating and destroying many tiny docker containers

I’m finishing up work on an app that lets users do coding challenges. It creates a docker container, runs / unit tests the code, destroys the container and sends stdout back to the client. The app works great on my local machine (with docker installed) but I’m having trouble figuring out how this is done in production.