This guide assumes that your django application already running in the container.
You will have to make sure that django-extensions and jupyter packages are installed in the container's python virtual environment.
If you need to shell into the container as root user to do this, you can do so from the host PC:
docker exec -it --user root <container_name> /bin/bashThen the actual package installation:
pip install django-extensions jupyterWe need to supply the address 0.0.0.0 as jupyter notebook ip parameter. But since the server will be run via django-extensions plugin, this needs to be done in django settings. To find out which settings module is used by the container you can look up the DJANGO_SETTINGS_MODULE environment variable:
echo $DJANGO_SETTINGS_MODULEAnd add the following setting to the module it refers to (you can adjust the port parameter value as needed):
NOTEBOOK_ARGUMENTS = [
'--ip', '0.0.0.0',
'--port', '8888'
]Exit from the container and restart it from the host PC:
docker restart <container_name>Then find out its IP address:
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' <container_name>
First, shell into the container:
docker exec -it <container_name> /bin/bashThen navigate into the directory where manage.py module is located. And run jupyter notebook from django management command:
./manage.py shell_plus --notebookDuring launch jupyter notebook server will show the address and port and token that you will need to use as URL to access it.
You need to replace the IP adress of the URL with the IP address of the container. Open your browser and point to the URL:
http://<ip_address>:8888/?token=<token_value>
You can create new django-shell notebook from the New drop down button on the top right corner of the jupyter notebook server homepage.