1

I launched jupyterlab 3 via a Dockerfile which includes some extensions like mathjax3-extension. If i run it, i need to enable the extension manager first before the extensions are working e.g. latex is rendered. Is there a way to include a Docker command to enable the extension manager by default? I found this here, but cannot translate it to a Docker command.

user23657
  • 131
  • 1
  • 2
  • 11

2 Answers2

1

You can place a pre-built settings file in the user's directory at ~/.jupyter/jupyter_notebook_config.py, or set systemwide defaults in /etc/jupyter/jupyter_notebook_config.py.

For an example implementation, see the jupyter project's base-notebook docker image, which sets system defaults by copying the jupyter_notebook_config.py file you can view in the root directory.

This file is then copied into place within the dockerfile (L155):

# Currently need to have both jupyter_notebook_config and jupyter_server_config to support classic and lab
COPY jupyter_notebook_config.py /etc/jupyter/
Michael Delgado
  • 13,789
  • 3
  • 29
  • 54
0

There is a settings file Jupyter Lab looks to check that you have read the warning about extensions and agreed to enable them. You need to add this file.

Add a line to your docker:

COPY ./plugin.jupyterlab-settings /home/$USER/.jupyter/lab/user-settings/@jupyterlab/extensionmanager-extension/

The above command assumes:

  1. $USER is assumed to be defined earlier in your dockerfile.

  2. plugin.jupyterlab-settings is a file with the following contents:

    {
        // Extension Manager
        // @jupyterlab/extensionmanager-extension:plugin
        // Extension manager settings.
        // *********************************************
    
        // Disclaimed Status
        // Whether the user understand that extensions managed through this interface run arbitrary code that may be dangerous
        "disclaimed": true
    }
    
Kevin
  • 4,070
  • 4
  • 45
  • 67