Skip to article frontmatterSkip to article content

Abstract

This guide will help you install Docker, pull and run the multi-architecture Docker image chungc/cs5483nb running JupyterLab, and use nbgitpuller to clone a GitHub repository into a specified subfolder.

A Docker container is like a lightweight, standalone, and executable package that includes everything needed to run a piece of software, including the Jupyter server used for our course. If you know about virtual machines, you may think of a docker container as a separate virtual machine running on your host machine, but with much less overhead. Indeed, you can also run the Jupyter server locally in your computer by installing Docker as follows.

Step 1: Install Docker

  1. Download and install Docker Desktop for your operating system from the official Docker website.
  2. Run the installer and follow the on-screen instructions. See the additional setup if you would like to use docker for WSL2 on Windows.
  3. Once installation is complete, open Docker Desktop and ensure it is running.

Step 2: Pull the Docker Image

Open a terminal (Command Prompt on Windows or Terminal on macOS) and run the following command to pull the Docker image:

docker pull chungc/cs5483nb

There is no need to pull the image again unless the image is updated.

Step 3: Run the Docker Container

Navigate to your working directory (e.g., cs5483_home) where you want to map to the home directory of the docker container:

cd /part/to/cs5483_home

Run the Docker container with the following command:

docker run -it --rm \
  -p 8888:8888 \
  -v $(pwd):/home/jovyan/ \
  chungc/cs5483nb \
  start-notebook.sh \
  --IdentityProvider.token=''

By using the -p 8888:8888 option in the docker run command, you’re essentially creating a network bridge that allows you to access the service running inside the Docker container (JupyterLab on port 8888) from your host machine using http://localhost:8888. This port mapping facilitates communication between the host and the container while preserving the isolation and lightweight nature of Docker containers. If port 8888 is occupied in your host by other web apps, you may change it to another number such as 5483.

By mounting your current working director in the host with -v $(pwd):/home/jovyan/work, the files in the container is stored in the working directory in your host, meaning that they persist even after the container is removed.

Step 4: Access the JupyterLab and Notebooks

If successful, the following message will appear but with a different token or no tokens.

...
    To access the server, open this file in a browser:
        file:///home/jovyan/.local/share/jupyter/runtime/jpserver-7-open.html
    Or copy and paste one of these URLs:
        http://2d94aee27406:8888/lab?token=afe3d84a4cadff3fe397640f651de4805471e7b19d1d6f1e
        http://127.0.0.1:8888/lab?token=afe3d84a4cadff3fe397640f651de4805471e7b19d1d6f1e

Copy and paste the last URL into your web browser to login to the JupyterLab.

To access the course notebooks, open a new terminal within the JupyterLab interface and run the following command:

gitpuller https://github.com/dive4dec/cs5483_24b main cs5483_24b