GithubHelp home page GithubHelp logo

b-data / jupyterlab-r-docker-stack Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 0.0 40.14 MB

(GPU accelerated) Multi-arch (linux/amd64, linux/arm64/v8) JupyterLab R docker images. Please submit Pull Requests to the GitLab repository. Mirror of

Home Page: https://gitlab.com/b-data/jupyterlab/r-project/docker-stack

License: Other

Shell 21.13% Dockerfile 78.10% CSS 0.19% Python 0.58%
data-science docker jupyterlab multi-arch r code-server images vscode cuda gpu

jupyterlab-r-docker-stack's Introduction

minimal-readme compliant Project Status: Active – The project has reached a stable, usable state and is being actively developed. Donate using Liberapay

See the CUDA-enabled JupyterLab R docker stack for GPU accelerated docker images.

JupyterLab R docker stack

Multi-arch (linux/amd64, linux/arm64/v8) docker images:

Images considered stable for R versions ≥ 4.2.0.
👉 The current state may eventually be backported to versions ≥ 4.0.4.

🔬 Check out jupyterlab/r/verse at https://demo.jupyter.b-data.ch.

Screenshot

Build chain

base → tidyverse → verse → geospatial → qgisprocess
ℹ️ The term verse+ means verse or later in the build chain.

Features

  • JupyterLab: A web-based interactive development environment for Jupyter notebooks, code, and data. The images include
    • code-server: VS Code in the browser without MS branding/telemetry/licensing.
    • Git: A distributed version-control system for tracking changes in source code.
    • Git LFS: A Git extension for versioning large files.
    • GRASS GIS: A free and open source Geographic Information System (GIS).
      ℹ️ qgisprocess image
    • Orfeo Toolbox: An open-source project for state-of-the-art remote sensing.
      ℹ️ qgisprocess image (amd64 only)
    • Pandoc: A universal markup converter.
    • Python: An interpreted, object-oriented, high-level programming language with dynamic semantics.
    • QGIS: A free, open source, cross platform (lin/win/mac) geographical information system (GIS).
      ℹ️ qgisprocess image
    • Quarto: A scientific and technical publishing system built on Pandoc.
      ℹ️ verse+ images
    • R: A language and environment for statistical computing and graphics.
    • SAGA GIS: A Geographic Information System (GIS) software with immense capabilities for geodata processing and analysis.
      ℹ️ qgisprocess image
    • TinyTeX: A lightweight, cross-platform, portable, and easy-to-maintain LaTeX distribution based on TeX Live.
      ℹ️ verse+ images
    • Zsh: A shell designed for interactive use, although it is also a powerful scripting language.

👉 See the Version Matrix for detailed information.

The following extensions are pre-installed for code-server:

Subtags

  • {R_VERSION,latest}-root (versions ≥ 4.2.0): Container runs as root
  • {R_VERSION,latest}-devtools (versions ≥ 4.2.2): Includes the requirements according to
  • {R_VERSION,latest}-devtools-root: The combination of both
  • {R_VERSION,latest}-docker (versions ≥ 4.2.2): Includes
    • docker-ce-cli
    • docker-buildx-plugin
    • docker-compose-plugin
    • docker-scan-plugin (amd64 only)
  • {R_VERSION,latest}-docker-root: The combination of both
  • {R_VERSION,latest}-devtools-docker: The combination of both
  • {R_VERSION,latest}-devtools-docker-root: The combination of all three

Table of Contents

Prerequisites

This projects requires an installation of docker.

Install

To install docker, follow the instructions for your platform:

Usage

Build image (base)

latest:

cd base && docker build \
  --build-arg R_VERSION=4.4.0 \
  -t jupyterlab/r/base \
  -f latest.Dockerfile .

version:

cd base && docker build \
  -t jupyterlab/r/base:MAJOR.MINOR.PATCH \
  -f MAJOR.MINOR.PATCH.Dockerfile .

For MAJOR.MINOR.PATCH4.2.0.

Create home directory

Create an empty directory using docker:

docker run --rm \
  -v "${PWD}/jupyterlab-jovyan":/dummy \
  alpine chown 1000:100 /dummy

It will be bind mounted as the JupyterLab user's home directory and automatically populated.
Bind mounting a subfolder of the home directory is only possible for images with R version ≥ 4.3.2.

Run container

self built:

docker run -it --rm \
  -p 8888:8888 \
  -u root \
  -v "${PWD}/jupyterlab-jovyan":/home/jovyan \
  -e NB_UID=$(id -u) \
  -e NB_GID=$(id -g) \
  -e CHOWN_HOME=yes \
  -e CHOWN_HOME_OPTS='-R' \
  jupyterlab/r/base[:MAJOR.MINOR.PATCH]

from the project's GitLab Container Registries:

docker run -it --rm \
  -p 8888:8888 \
  -u root \
  -v "${PWD}/jupyterlab-jovyan":/home/jovyan \
  -e NB_UID=$(id -u) \
  -e NB_GID=$(id -g) \
  -e CHOWN_HOME=yes \
  -e CHOWN_HOME_OPTS='-R' \
  IMAGE[:MAJOR[.MINOR[.PATCH]]]

IMAGE being one of

The use of the -v flag in the command mounts the empty directory on the host (${PWD}/jupyterlab-jovyan in the command) as /home/jovyan in the container.

-e NB_UID=$(id -u) -e NB_GID=$(id -g) instructs the startup script to switch the user ID and the primary group ID of ${NB_USER} to the user and group ID of the one executing the command.

-e CHOWN_HOME=yes -e CHOWN_HOME_OPTS='-R' instructs the startup script to recursively change the ${NB_USER} home directory owner and group to the current value of ${NB_UID} and ${NB_GID}.
ℹ️ This is only required for the first run.

The server logs appear in the terminal.

Using Podman (rootless mode, 4.3.2+)

Create an empty home directory:

mkdir "${PWD}/jupyterlab-root"

Use the following command to run the container as root:

podman run -it --rm \
  -p 8888:8888 \
  -u root \
  -v "${PWD}/jupyterlab-root":/home/root \
  -e NB_USER=root \
  -e NB_UID=0 \
  -e NB_GID=0 \
  -e NOTEBOOK_ARGS="--allow-root" \
  IMAGE[:MAJOR[.MINOR[.PATCH]]]

Using Docker Desktop

Creating a home directory might not be required. Also

docker run -it --rm \
  -p 8888:8888 \
  -v "${PWD}/jupyterlab-jovyan":/home/jovyan \
  IMAGE[:MAJOR[.MINOR[.PATCH]]]

might be sufficient.

Credential storage

❗ Keyring services are not available due to the difficulties of setting them up in containers.
Therefore, provide login credentials for the following extensions as environment variables (-e):

Extension Environment variable
GitHub Pull Requests and Issues GITHUB_TOKEN: Personal access token with scopes repo and user.1
GitLab Workflow GITLAB_WORKFLOW_INSTANCE_URL: GitLab instance URL (e.g. https://gitlab.com).
GITLAB_WORKFLOW_TOKEN: Personal access token with scopes api and read_user.

Similar projects

What makes this project different:

  1. Multi-arch: linux/amd64, linux/arm64/v8
    👉 Since R 4.0.4 (2021-02-15)
    ℹ️ Runs on Apple M series using Docker Desktop.
  2. Base image: Debian instead of Ubuntu
    ℹ️ CUDA-enabled images are Ubuntu-based.
  3. IDE: code-server instead of RStudio
    ℹ️ code-server = VS Code in the browser.
  4. Just Python – no Conda / Mamba

See Notes for tweaks, settings, etc.

Contributing

PRs accepted.

This project follows the Contributor Covenant Code of Conduct.

Support

For commercial support, please contact b-data by email: [email protected].

b-data tailors the JupyterLab images to your needs, e.g.

  • Integration of self-signed CA certificates to enable communication with web services on the intranet.
  • Setting up the necessary environment variables so that everything works behind a corporate proxy server.

Additionally, the JupyterHub setup can be customised to allow

  • authentication with AD/LDAP
  • mounting CIFS/SMB file shares

and much more.

Sponsors

Work partially funded by

Agroscope

License

MIT © 2020 b-data GmbH

Footnotes

  1. Device activation may require a one-time login from the extension's sidebar.

jupyterlab-r-docker-stack's People

Contributors

benz0li avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jupyterlab-r-docker-stack's Issues

Nushell vs zsh?

I recently switched from zsh to nushell and am very impressed with the latter, which is more data-driven and even integrates with the Python package Polars. Wondering if you'd consider switching over after taking a quick read of the README, great to see this in any case!

What about including RStudio Server OSE?

I have written the following emails to Posit:

From: Olivier Benz <[email protected]>
Date: Sunday, 14 April 2024 at 11:02
To: [email protected] <[email protected]>
Cc: JJ Allaire <[redacted]>
Subject: Re:JupyterLab R docker stack: Permission to include RStudio Server OSE

Dear Sir or Madam,

Still looking forward to an answer to my request.

We create our own docker stack, because I was neither happy with the Version-stable Rocker images nor the Jupyter Docker Stacks.

FYI @JJ

Best regards,
Olivier Benz
aka benz0li

https://github.com/quarto-dev/quarto-cli/issues?q=is%3Aissue+author%3Abenz0li
https://github.com/quarto-dev/quarto-cli/pulls?q=is%3Apr+author%3Abenz0li
From: Olivier Benz <[email protected]>
Date: Monday, 1 April 2024 at 12:58
To: [email protected] <[email protected]>
Subject: Re: JupyterLab R docker stack: Permission to include RStudio Server OSE

Dear Sir or Madam,

The JupyterLab R docker stack is similar to the binder image of the Rocker Project, which has been granted permission to distribute RStudio binaries through their images.

I would love to make RStudio available as an alternative IDE to code-server in my multi-arch (linux/amd64, linux/arm64) JupyterLab R docker stack.

Best regards,
Olivier Benz
From: Olivier Benz <[email protected]>
Date: Sunday, 17 March 2024 at 10:19
To: [email protected] <[email protected]>
Subject: JupyterLab R docker stack: Permission to include RStudio Server OSE

Dear Sir or Madam,

RStudio Server OSE (incl. Quarto) has been available for Linux AArch64 (aka arm64) for some time.

I would like to include it in our multi-arch (linux/amd64, linux/arm64) JupyterLab R docker stack.
* For further information, see https://github.com/b-data/jupyterlab-r-docker-stack

According to https://posit.co/about/trademark-guidelines/, I kindly ask for your permission to do so.

Thank you for your many years of contributions to open source software.

Best regards,
Olivier Benz

Still waiting for a response.

Getting docker running in spawned user container

@benz0li .. thanks for your efforts with these resources.

I am running up a user container using your glcr.b-data.ch/jupyterlab/r/verse:4.3.2-devtools-docker-root-linux-amd64 image. This looked like it was going to give me access to a running docker capability for user jovyan. While the docker executable is installed, I am getting Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?. I tried some of the obvious fixes like:

docker exec -it <spawned-user-container> bin/sh #to enable root access to the container
# then from within the container
sudo groupadd docker
sudo usermod -aG docker jovyan

However, this doesn't appear to fix. Any suggestions, if indeed this is possible. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.