# Slim docker image with Julia + IJulia

**URL:** https://discourse.julialang.org/t/slim-docker-image-with-julia-ijulia/20894
**Category:** General Usage
**Created:** [February 17, 2019, 8:30am UTC](https://discourse.julialang.org/t/slim-docker-image-with-julia-ijulia/20894 "2019-02-17T08:30:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![askvorts](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/askvorts/32/7120_2.png) [@askvorts](https://discourse.julialang.org/u/askvorts)
#### Post date: [February 17, 2019, 8:30am UTC](https://discourse.julialang.org/t/slim-docker-image-with-julia-ijulia/20894/1 "2019-02-17T08:30:47Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![asprionj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/asprionj/32/6856_2.png) [@asprionj](https://discourse.julialang.org/u/asprionj)
#### Post date: [February 17, 2019, 10:35pm UTC](https://discourse.julialang.org/t/slim-docker-image-with-julia-ijulia/20894/2 "2019-02-17T22:35:56Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)
#### Post date: [February 18, 2019, 12:00am UTC](https://discourse.julialang.org/t/slim-docker-image-with-julia-ijulia/20894/3 "2019-02-18T00:00:08Z")

</div>

> [@askvorts](#):
>
> Any suggestion would be much appreciated.

imho: You can build your customized docker image from the["official" Julia 1.1 image](https://hub.docker.com/_/julia/?tab=tags) - 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 )

```Dockerfile
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'

```

---

<div class="post-metadata">

### Author: ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)
#### Post date: [February 18, 2019, 12:04am UTC](https://discourse.julialang.org/t/slim-docker-image-with-julia-ijulia/20894/4 "2019-02-18T00:04:54Z")

</div>

> [@asprionj](#):
>
> whether Julia can be compiled on/for [Alpine Linux](https://alpinelinux.org/)

some problems (with “musl libc”):

- [https://github.com/JuliaLang/julia/search?q=alpine&type=Issues](https://github.com/JuliaLang/julia/search?q=alpine&type=Issues)
- [Support for Alpine Linux (musl libc) · Issue #102 · JuliaCI/julia-buildbot · GitHub](https://github.com/JuliaCI/julia-buildbot/issues/102)

---

<div class="post-metadata">

### Author: ![askvorts](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/askvorts/32/7120_2.png) [@askvorts](https://discourse.julialang.org/u/askvorts)
#### Post date: [February 18, 2019, 4:05pm UTC](https://discourse.julialang.org/t/slim-docker-image-with-julia-ijulia/20894/5 "2019-02-18T16:05:30Z")

</div>

@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

```julia
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

```

---

<div class="post-metadata">

### Author: ![ImreSamu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/imresamu/32/20677_2.png) [@ImreSamu](https://discourse.julialang.org/u/ImreSamu)
#### Post date: [February 18, 2019, 5:07pm UTC](https://discourse.julialang.org/t/slim-docker-image-with-julia-ijulia/20894/6 "2019-02-18T17:07:49Z")

</div>

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

the other method is using the “jupyter/minimal-notebook” + adding `julia`, `Ijulia`  
like this [julia\_notebook/Dockerfile at master · andferrari/julia\_notebook · GitHub](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 )
