Launching containers in subdomain

What I want to do is to trigger the launch of a container in a subdomain and then kill it.

Let’s say I have an apache server, serving an app on /www/myapp. This app has a web interface, in which the user can choose some exercises.

When the user clicks e.g. exercise 1, what I want to have is, with the help of backend scripting (python) a container launches which creates a simple html file and maybe some very light db that is served in /www/myapp/exercise1. Then it gets a url, lets say (or something random) which is accessible from the browser. After the user finishes, I want some kind of feedback e.g. json file, with my main db and then the container gets destroyed. Is this possible to be done?

its possible, though you’ll need some kind of web proxy which is listening to both port 80 for the browser, and to the docker events so that it knows where to route things.