/Jupyterlab

🪐 Hassle-free JupyterLab 3.5.2 and Python 3.11 Docker container with root user

Primary LanguagePythonMIT LicenseMIT

License: MIT Publish Docker image

Jupyterlab Docker container

This Docker container runs as root user! It can be helpful when e.g. the popular jupyter/datascience-notebook image does not work because it runs as Jovyan user.

Additional packages can be installed on creation of container by adding to requirements.txt.

Changed base url to make operation behind appache reverse proxy easier: http://localhost:8888/jupyter

Installed kernels

  • Python 3.11 with autocomplete and suggestions (LSP)

Installed Jupyterlab extensions

Your notebooks

Volumes can be mounted into /notebooks folder.

The container will install requirements from files present in the /notebooks folder when it starts up (in this order):

  • packages.txt: install apt-get packages
  • requirements.txt: install pip packages
  • extensions.txt: install JupyterLab extensions

Pull/Update to latest version

docker pull ghcr.io/ptr33/jupyterlab:latest

Run

docker run --rm -it -p 8888:8888 ghcr.io/ptr33/jupyterlab

or if you want to define your own password and shared volume:

docker run --rm -it -p 8888:8888 -v $(pwd)/data:/notebooks -e PASSWORD="password" ghcr.io/ptr33/jupyterlab

Run from Git repository

You can provide a Git repository to be cloned in /notebooks when starting the container (it will automatically install packages if requirements.txt, packages.txt or extensions.txt are present at the root of the repository).

docker run --rm -it -p 8888:8888 -v /data/jupyterlab-notebooks:/notebooks -e PASSWORD="<your_secret>" -e GIT_URL="https://github.com/vemonet/translator-sparql-notebook" ghcr.io/ptr33/jupyterlab:latest

Access on http://localhost:8888/jupyter and files shared in /data/jupyterlab-notebooks

or use the current directory as source code in the container:

docker run --rm -it -p 8888:8888 -v $(pwd):/notebooks -e PASSWORD="<your_secret>" ghcr.io/ptr33/jupyterlab:latest

Use ${pwd} for Windows

Run with docker-compose

Add JupyterLab to a docker-compose.yml file:

services:
  jupyterlab:
    container_name: jupyterlab
    image: ghcr.io/ptr33/jupyterlab
    ports:
      - 8888:8888
    volumes:
      - ./data:/notebooks
    environment:
      - PASSWORD=password
      - GIT_URL=https://github.com/vemonet/translator-sparql-notebook

Build from source

Clone the repository, then build the container image:

git clone https://github.com/ptr33/Jupyterlab.git
cd Jupyterlab
docker build -t ghcr.io/ptr33/jupyterlab .