• Ian Stuart's picture

    Changing the location of a Notebooks configuration file

    Ian Stuart / August 13, 2017
  • We are running notebooks in Docker Containers, and have a need to move the location of the configuration file

    This is great in some ways: they are self-contained objects; they have relatively small foot-prints; they are quick to spin up; they are designed to be ephemeral.
    Their very ephemeral nature has a couple of problems though: you need to re-create the docker image if you want additional libaries; there is no persistent data-storage.

    We need persistent storage for our Notebooks, therefore we have to mount some external storage into the Docker Container..... which means we can no longer rely on the default ~/.jupyter/ directory for the configuration file.

    This, however, is easy to overcome as this location can be defined with the environment variable JUPYTER_CONFIG_DIR.

    In your Dockerfile, add the following:

        COPY jupyter_notebook_config.py /etc/jupyter/
        ENV JUPYTER_CONFIG_DIR /etc/jupyter

    (this will also create the appropriate directories for you)