JupyterLab Container - activoricordi/notebooks GitHub Wiki

Jupyterlab Container

Base Container

Conda is a useful tool for managing application dependencies. Conda installs any package within conda environments.When combined with Docker, it is important to take a quite a number of considerations to avoid having a very large images.


Choose right Base Image

It is important to choose the right .For instance, it is prefereable to choose Python 3 images based on Debian instead of choosing using an Alpine. The reason for this behaviour is that most wheels are built for Debian and not for Alpine. Therefore, Python extensions with C or code from other languages need to be compiled for Alpine.



ARG NB_USER="notebooks"
ARG NB_UID="1000"
ARG NB_GID="100"

ENV DEBIAN_FRONTEND noninteractive

Python Package Manager

It is important to do mix the installation of the Linux and Python Package Manager

Install Mamba Package Manager

Again, we do not install anymore things with Conda.

Python Libraries


This is file used for creating Conda Virtual Environment

ADD environment.yml /tmp/environment.yml
RUN conda env create -f /tmp/environment.yml

# Pull the environment name out of the environment.yml
RUN echo "source activate $(head -1 /tmp/environment.yml | cut -d' ' -f2)" > ~/.bashrc
ENV PATH /opt/conda/envs/$(head -1 /tmp/environment.yml | cut -d' ' -f2)/bin:$PATH

This last step is from Conda environments with Docker

name: JupyterLab
    - conda-forge
     - pandas	
     - numpy
     - scikit-learn
     - ipywidgets

Set User

USER notebooks
WORKDIR /workspace