There are a few websites that allow you to code in a online editor, and then it compiles on a server and displays the output.
I am guessing they are using docker and/or lxc to create a safe environment and isolate it for each session.
How do they display exactly what the terminal is displaying like e.g. the compile errors or the running output?