How do you run a JupterLab Docker container in privileged mode?

I have setup JupyterHub with DockerSpawner and Auth0, this is working well with stock JupyterLab images.

Now I am trying to use my own custom JupyterLab image which is based off of base-notebaook. However as I want to be able to access the hardware on the host machine I have enabled UDEV in the image. This means that I need to run the JupterLab container in privileged mode.

I have tried to use variations of the following to get this to work:

# Attempt to use extra_create_kwargs
c.DockerSpawner.extra_create_kwargs = {
   "privilege": True
}

# Attempt use extra_host_config
c.DockerSpawner.extra_host_config = {
   "privilege": True
}

I am pretty sure that I have got the name of the configuration item wrong and where it is set but I cannot work it out and I have not been able to find it in the documentation anywhere online.

So how can this be achieved?

Can you try privileged (d on the end) in extra_host_config?:
https://docker-py.readthedocs.io/en/4.2.2/api.html?highlight=privileged

@manics Thanks again you have sorted it

I thought I had tried it with privileged but obviously not.

1 Like