Running SwarmSpawner with c.SwarmSpawner.extra_create_kwargs = {"user": "root"}
fails
#497
Labels
c.SwarmSpawner.extra_create_kwargs = {"user": "root"}
fails
#497
Bug description
I have SwarmSpawner working on a cluster (details below), but would like to run JupyterStacks containers with the logged in username and UID. Running a container directly as per the docs works correctly, e.g. something like:
With SwarmSpawner I can pass the env settings without issues (see note below on the method), but my spawn fails when I add
c.SwarmSpawner.extra_create_kwargs = {"user": "root"}
(as specified for changing the user in the SwarmSpawner docs)Note: for user management I'm using LDAP, and pulling the user info with a pre-spawn-hook routine (see config section below). The working environmental settings go via lines like
spawner.environment['NB_UID'] = str(spawner.userdata['uidNumber'][0])
, whereuserdata
is populated for the given user from the LDAP server.In my case I'm stuck running a fairly old version of Docker (20.10.7, API 1.41), so I'm guessing this is the cause of the issue, but it would be good to confirm this, and not just that I'm doing something stupid!
Work-around: building images from Docker Stacks locally and setting the user to root avoids the need to pass
--user root
, and works as desired with the SwarmSpawner and passed env settings in my case. A minimal Dockerfile example for this is simply:In this case, containers spawn as expected, and accept the additional user environmental settings passed at spawn.
How to reproduce
Add the line
c.SwarmSpawner.extra_create_kwargs = {"user": "root"}
to a working SwarmSpawnerjupyterhub_config.py
and test!Expected behaviour
Equivalent to
docker run --user root
as per the documentation.Actual behaviour
Error on Spawn, specifically
TypeError: ServiceApiMixin.create_service() got an unexpected keyword argument 'user'
. (I also tested for "--user", "u" and "-u" instead of "user", but got the same result.)Your personal set up
Configuration
The text was updated successfully, but these errors were encountered: