title: How do I limit resources for ffmpeg, called from a python-script, running in a docker container?
body: <p>I deployed a service, that periodically does video encoding on my server; And every time it does, all other services slow down significantly. The encoding is hidden under multiple layers of abstraction. Limiting any of those layers would be fine. (e.g. limiting the docker-container would work just as well as limiting the ffmpeg-sub process.)</p>
  
  <p>My Stack: </p>
  
  <ol>
  <li>VPS (ubuntu:zesty)</li>
  <li>docker-compose</li>
  <li>docker-container (ubuntu:zesty)</li>
  <li>python</li>
  <li>ffmpeg (via subprocess.check_call() in python)</li>
  </ol>
  
  <p>What I want to limit: </p>
  
  <ul>
  <li>CPU: single core </li>
  <li>RAM: max 2 GB</li>
  <li>HDD: max 4 GB</li>
  </ul>
  
  <p>It would be possible to recompile ffmpeg if needed.</p>
  
  <h3>What would be the place to put limits in this stack?</h3>