Skip to content

nmfs-opensci/py-rocket-base

py-rocket-base: JupyterHub base image

Build and push container imageDOIGitHub Release

The py-rocket-base image is a base image for the JupyterHubs with Python and RStudio. The py-rocket-base image uses the Pangeo base-image (minus the ONBUILD commands) as the base image (stored in py-rocket-base/base-image) and the pangeo-notebook metapackage to setup the core JupyterHub environment (following Pangeo base-notebook. Additional Python packages are installed to provide a fuller JupyterLab, RStudio, Desktop, and VSCode environment. The R environment is installed with Rocker installation scripts. You can scroll through the Rocker installation scripts to see how that environment is set up.

image url

ghcr.io/nmfs-opensci/py-rocket-base:latest

The base image has the following support:

  • Python + JupyterLab with mamba handling package installation
  • R + RStudio with the rocker scripts and other functions available
  • Desktop ready for installing applications, including Java-based applications
  • VSCode

There are many ways to install R and RStudio into an image designed for JupyterHubs. The objective of py-rocket-base is to create a JupyterHub (or binder) image such when you click the RStudio button in the JupyterLab UI to enter the RStudio UI (/rstudio), you enter an environment that is the same as if you had used a Rocker image but if you are in the JupyterLab UI (/lab), the environment is the same as if you had used repo2docker to create the environment. There are many other ways to install R and RStudio in a JupyterHub image. See History below for other approaches we have used.

Using this in a JupyterHub

If the JupyterHub has the Bring your own image feature, then you can paste in ghcr.io/nmfs-opensci/py-rocket-base:latest to the image and a server with your image will spin up.

image

Using this as a base image

py-rocket-base has basic structure like the pangeo base-image and repo2docker images. To use as a base image, include this in your Docker file

FROM ghcr.io/nmfs-opensci/py-rocket-base:latest

py-rocket-base has pyrocket and rocket scripts that you can use to help customize your image and add more conda, R or linux packages. See the documentation on customizing images.

History and motivation

The original py-rocket 1.0 was developed by Luis Lopez and was built off a Rocker base image. Carl Boettiger and Eli Holmes later altered the image (py-rocket 2.0) so that the Python environment matched the Pangeo image structure but the image was still built off a Rocker image. Subsequently, Carl Boettiger developed repo2docker-r that creates a JupyterHub-compatible image that uses a Jupyter docker stack image as base. For py-rocker 3.0, Eli Holmes used Carl's ideas but used repo2docker and repo2docker-action to build the base image. To do this, the CryoCloud hub image repo was used for the basic structure and approach. Eli added the rocker.sh script and appendix modifications to install R and RStudio via the Rocker scripts (rather than using a Rocker image as base). Yuvi Panda (repo2docker) gave input throughout the process as snags were hit.

Why Rocker for the R/RStudio environment? The Rocker images are the standard for R/RStudio contanier images. They are heavily tested and regularly updated. There is a large developer community that fixes problems and bugs. The stack has gone through major revisions to improve modularity and they constantly innovating (integration for machine-learning, CUDA, BLAS, spatial, etc., etc.). py-rocket is building off that work without using the images directly. Instead it uses the Docker file code and the installation scripts. There are many other approaches to adding R and RStudio to images that work in JupyterHubs. See repo2docker-r that Carl developed and r-conda for a conda native approach using repo2docker. py-rocket is not intended to create small images; it is intended to create images that emulate Rocker in the /rstudio environment on a JupyterHub.