title: JupyterHub with SystemUserSpawner fails
body: <p>I'm trying to run a JupyterHub on a virtual machine, using the <code>dockerspawner.SystemUserSpawner</code>, spawning Jupyter Lab instances.</p>
  
  <p>My jupyterhub_config.py has the following (extra) lines:</p>
  
  <pre><code>c.Spawner.default_url = '/lab'
  c.Spawner.cmd = ['jupyter', 'labhub']
  c.JupyterHub.spawner_class = 'dockerspawner.SystemUserSpawner'
  </code></pre>
  
  <p>(plus lines for the <code>bind_url</code> and <code>hub_ip</code>). Everything else should be the default.</p>
  
  <p>Upon running (<code>jupyterhub -f /etc/jupyterhub/jupyterhub_config.py</code>) and logging in in the browser, I run into a 500 error. The log on the command line looks as follows:</p>
  
  <pre><code>[D 2019-02-26 16:55:37.869 JupyterHub dockerspawner:644] Getting container 'jupyter-testuser'
  [D 2019-02-26 16:55:37.873 JupyterHub dockerspawner:629] Container 8bf627d status: {'Dead': False,
       'Error': '',
       'ExitCode': 1,
       'FinishedAt': '2019-02-26T15:55:29.518823812Z',
       'OOMKilled': False,
       'Paused': False,
       'Pid': 0,
       'Restarting': False,
       'Running': False,
       'StartedAt': '2019-02-26T15:55:28.446881243Z',
       'Status': 'exited'}
  [W 2019-02-26 16:55:37.874 JupyterHub web:1667] 500 GET /hub/user/testuser/ (www.xxx.yyy.zzz): Spawner failed to start [status=ExitCode=1, Error='', FinishedAt=2019-02-26T15:55:29.518823812Z]. The logs for testuser may contain details.
  [D 2019-02-26 16:55:37.875 JupyterHub base:880] No template for 500
  </code></pre>
  
  <p>JupyterHub itself then gets stuck in a (endless?) loop trying to spawn the container every 10 seconds.</p>
  
  <p>Ignoring the missing 500 template, I was little the wiser from the container status message, but <code>docker logs jupyter-testuser</code> shows:</p>
  
  <pre><code>....
  [C 2019-02-26 15:55:29.360 SingleUserLabApp notebookapp:1707] Running as root is not recommended. Use --allow-root to bypass.
  [D 2019-02-26 15:55:29.360 SingleUserLabApp application:647] Exiting application: jupyter-notebook
  </code></pre>
  
  <p>When I change <code>jupyterhub_config.py</code> to include</p>
  
  <pre><code>c.Spawner.cmd = ['jupyter', 'labhub', '--allow-root']
  c.DockerSpawner.remove = True
  </code></pre>
  
  <p>things do work, but with an unwanted caveat: I'm now root in the container, and any file I create in the home directory is not owned by <code>testuser</code>, but by the (Docker container) <code>root</code>. Inside the VM itself, <code>testuser</code> can't, for example, delete those files.</p>
  
  <p>(note on <code>c.DockerSpawner.remove = True</code>: if I don't include that, JupyterHub gets stuck on the previous container which didn't have <code>--allow-root</code>)</p>
  
  <p>The documentation suggests the initial configuration should be correct, and <code>--allow-root</code> is not necessary for a standard docker stack (I'm obviously using the default one here, <code>jupyterhub/singleuser:0.9</code>). </p>
  
  <p>For comparison, using the <code>dockerspawner.DockerSpawner</code> works fine.</p>
  
  <p>I don't see what I'm missing, or where to look for more debugging options. Any suggestions are therefore welcome.</p>
  
  <p>Jupyter(Hub) version 0.9.4 on Ubuntu 18.04.2</p>