Slim docker image with Julia + IJulia

#1

I am searching for a Julia 1.0/1.1 + IJulia docker image not too big to distribute to my students (after adding to the image just a few more packages). The one from jupyter/datascience-notebook unfortunatelly is over 6.2 GB! Any suggestion would be much appreciated.

0 Likes

#2

Would be interesting to know whether Julia can be compiled on/for Alpine Linux, which is a very small distro especially suited for VM’s and docker images. Any experiences?

1 Like

#3

imho: You can build your customized docker image from the"official" Julia 1.1 image - and you can add any packages as you like.

for example - this is ~ 635MB image size on the disk ( the base julia:1.1 size ~450MB disk size )

FROM julia:1.1
RUN julia -e 'using Pkg; Pkg.REPLMode.pkgstr("add IJulia     ;precompile");using IJulia'
RUN julia -e 'using Pkg; Pkg.REPLMode.pkgstr("add CSV        ;precompile");using CSV'
RUN julia -e 'using Pkg; Pkg.REPLMode.pkgstr("add DataFrames ;precompile");using DataFrames'
RUN julia -e 'using Pkg; Pkg.REPLMode.pkgstr("add DataStreams;precompile");using DataStreams'
RUN julia -e 'using Pkg; Pkg.REPLMode.pkgstr("add JSON       ;precompile");using JSON'
RUN julia -e 'using Pkg; Pkg.REPLMode.pkgstr("add LibPQ      ;precompile");using LibPQ'
RUN julia -e 'using Pkg; Pkg.REPLMode.pkgstr("add SQLite     ;precompile");using SQLite'
RUN julia -e 'using Pkg; Pkg.REPLMode.pkgstr("add XLSX       ;precompile");using XLSX'
4 Likes

#4

some problems (with “musl libc”):

0 Likes

#5

@ImreSamu thank you very much for your suggestion. I believe that we would need more work for the IJulia package. There are some missing OS dependencies (e.g. wget, bzip2…) and we would also need to install Conda into the image and afterwards Jupyter

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -yq dist-upgrade \
 && apt-get install -yq --no-install-recommends \
    wget \
    bzip2 \
    ...
ENV MINICONDA_VERSION 4.5.12
RUN wget --quiet https://repo.continuum.io/miniconda/Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh && \
    echo "e1045ee415162f944b6aebfe560b8fee *Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh" | md5sum -c - && \
    /bin/bash Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh -f -b -p $CONDA_DIR && \
    rm Miniconda3-${MINICONDA_VERSION}-Linux-x86_64.sh \
    ...
RUN conda install --quiet --yes 'notebook=5.7.2' \
    'jupyterlab=0.35.4' \
    ...
# Also deal with X Rendering and so on
0 Likes

#6

@askvorts: Sorry for my misunderstanding.
your solution looks good,

the other method is using the “jupyter/minimal-notebook” + adding julia, Ijulia
like this https://github.com/andferrari/julia_notebook/blob/master/Dockerfile
( 2 kernel: Julia1.1 + Python3 ) Size on the disk ~ 3.55GB
ps:
( And this time I have checked the jupyter browser frontend ; and a simple julia test is working )

0 Likes