<p>I'm working on a personal project involving a browser-based code editor (think <a href="https://repl.it" rel="nofollow noreferrer">https://repl.it</a>). My plan:</p>

<p>1) Constantly stream the code being written to a remote docker volume on kubernetes.</p>

<p>2) Execute this code when the user presses "run".</p>

<p>I've already started working on the streaming infrastructure, and have a good grasp on how I'd like to do it. Regarding the code execution, however, I'm in need of some guidance.</p>

<p>Idea A: I was thinking that I could have two docker containers, one web server and one "environment", sitting on the same VM. When a request would come into the webserver, it would then run a <code>docker exec ...</code> on the environment. </p>

<p>Idea B: I use <code>kubectl</code>, specifically <code>kubectl exec</code> to execute the code on the container.</p>

<p>A few things to note. I want to make the "environment" container interchangeable, that is, my app should be able to support python, js, etc.. Any thoughts? </p>

<ol>
<li>THIS IS A VERY BAD IDEA DO NOT DO IT</li>
<li>You would want to run each snippet in a new container for maximum isolation.</li>
</ol>
