Jupyter Lab application features nice Terminas with in-browser terminal shell that support colours, navigation keys, and pretty much all standard features of a terminal application. In this question I mean /lab
app, not classic Notebook (/tree
) app.
If I launch Jupyter server using this Docker image it works great. I need to build my own image, and preferably not based on that. I do it simply as documented:
docker run -it --rm -p 8888:8888 -v "$PWD":/jupyter python:3.8 bash
# pip install jupyterlab
# jupyter lab --config=/jupyter/jupyter_notebook_config.py
The above is assuming I have a jupyter_notebook_config.py
in the current directory:
c.NotebookApp.ip = '0.0.0.0'
c.NotebookApp.port = 8888
c.NotebookApp.password = 'sha1:<salt>:<hash>'
c.NotebookApp.allow_password_change = False
c.NotebookApp.allow_root = True
c.NotebookApp.open_browser = False
Everything works, but Terminal performs very poor, it does not support colours and send codes (like ^[[A
, ^[[B
) instead of arrow keys. Line-by-line investigation of the Dockerfile is not so exciting endeavour, may be somebody can point me to what I am mising?
EDIT: I was little bit wrong about colours (was confused by the default green prompt in the jupyter/base-notebook
image) and the overall issue description. The root cause was that the shell that is started in my image is sh
while in the official image it is bash
. But nevertheless Terminal is not fully functional, e.g. if I launch nano, it starts only in 80x25 characters area and does not stretch to the actual size of the terminal). Arrows work in nano though.
So I figured out the reason. Apparently the Terminal web app just replicates the behaviour of the default shell of the user under which Jupyter is run. In this image they enable colouring in .bashrc template and then create a new user specifying a shell for him (lines 52 and 59).
EDIT: also SHELL=/bin/bash
must be set in environment.