Change config_file for jupyter notebook in Dockerfile

When setting up Jupyter Notebook I adjust the file jupyter_notebook_config.py. How can I make these adjustments in the Dockerfile during the build. I specifically have the following code in my config file:

c = get_config()

c.NotebookApp.ip = ‘*’

c.NotebookApp.open_browser = False

c.NotebookApp.port = 8888

I know the command options for jupyter notebook:

jupyter notebook --ip=’*’ --no-browser --port=8888

I also know that with --generate-config I can create the config file.

However, when I run it in the Dockerfile I end up with the default config file in the container and I need to adjust manually again.

Is there a way to create the correct config file during the build by adjusting the Dockerfile

Have you tried using a Copy in your dockerfile? You could pre-create jupyter_notebook_config.py where dockerfile is located and include the following:

COPY jupyter_notebook_config.py /config/location/jupyter_notebook_config.py

Thank you, that works.