How to dockerize Jupyter lab

Whilst searching around I came across this question, before going on to discover a reference to Jupyter Labs in the 'Read The Docs' pages for Jupyter Docker Stacks (see here). The documentation says:

JupyterLab is preinstalled as a notebook extension starting in tag c33a7dc0eece.

and they suggest using a command like:

docker run -it --rm -p 8888:8888 jupyter/datascience-notebook start.sh jupyter lab

I thought I might as well add the reference here in case it's useful for others. (It's not immediately obvious on Docker Hub for example, that there is support for Jupyter Labs.)


When you start jupyter lab you should define --ip parameter. For example, --ip=0.0.0.0.

After this you will have another error:

[C 08:14:56.973 LabApp] Running as root is not recommended. Use --allow-root to bypass.

So, if you want to proceed you need to add --allow-root as well.

The final Dockerfile is:

FROM python:3.6

WORKDIR /jup

RUN pip install jupyter -U && pip install jupyterlab

EXPOSE 8888

ENTRYPOINT ["jupyter", "lab","--ip=0.0.0.0","--allow-root"]