[erlang-questions] trying to make official docker images for erlang

derek denc716@REDACTED
Wed Sep 30 05:42:58 CEST 2015


Hi to Erlang users,

this is effort trying to make official docker images for erlang otp
community, please comment if you like to run it with docker:

https://github.com/docker-library/official-images/pull/1075

Nowadays, docker is the popular way to run many applications, have a
look on docker hub, many popular programming languages and
applications have an official image there, beginners can easily pull a
docker image to start playing without hassling their host Linux,

https://hub.docker.com/_/python/
https://hub.docker.com/_/golang/
https://hub.docker.com/_/ruby/
...

But there is no official one for erlang yet, let's try to make it happen,
https://hub.docker.com/_/erlang/

I have researched some existing effort like these, looks like many
ones are already on this way just haven't communicated thru
@erlang.org yet

- https://hub.docker.com/r/correl/erlang/
   this might be the earliest currently have the most stars by `docker
search erlang`, provided erlang-otp-17.5 and rebar and relx in a
single image, and compiling each one from source code, I haven't tried
it, but presumably would be close to 1GB image;
- https://hub.docker.com/r/unbalancedparentheses/erlang
   this one support all versions of erlang R6B-0, R7, R8, ... R16, up to 17.4
   from https://github.com/unbalancedparentheses/docker-erlang/blob/master/17.4/install.sh
it also provided erlang & rebar & relx all compiled from source code
- https://hub.docker.com/r/msaraiva/erlang/
   this one is providing erlang-17.5 and 18, on top of Alpine Linux
docker image, it's very slim, as small as 16.78 MB, while erlang lib
is broken into very small packages, like most OS distro does, broken
into erlang-compiler, erlang-dialyzer, erlang-otp, erlang-snmp, and
etc. its base erlang:18 image has 5 packages under
/usr/lib/erlang/lib/... (compared a full erlang-otp has 52 lib
packages)
  http://dl-4.alpinelinux.org/alpine/edge/main/x86_64/ (search erlang)
   this one also provided elixir images in different Dockerfile,
presumably also slim
- https://hub.docker.com/r/voidlock/erlang
    is very similar to my way, support erlang R16 thru 18.1; I would
not start my project if I know this earlier, but it installed
update-locale for UTF-8 I'm not sure for what, is that required by
erlang runtime ?
- https://github.com/synctree/docker-erlang/blob/master/R17/Dockerfile
  this one installs erlang solutions precompiled deb on top of
debian:8 (or debian:jessie) image.

$ docker search erlang
NAME                           DESCRIPTION
        STARS     OFFICIAL   AUTOMATED
correl/erlang                  Erlang/OTP for Docker
        14                   [OK]
...

While I just started from scratch, before above PR to official images
got merged, you can try it with cloning this repo, and build images
locally,

https://github.com/c0b/docker-erlang-otp

So there are two ways to make images:
1) build from source code, from standard debian:8 image, start with
apt-get install build-essential and gcc and some lib...-dev and
download erlang-otp source code and build, this usually ends up with a
fat image, close to 1GB;
2) install from some binary erlang packages, like the one from
erlang-solutions, could end up with smaller image; packages from most
OS distributions also provided erlang but relatively not up to date
like debian https://packages.debian.org/source/sid/erlang fedora
centos similar

Here from my repo I mainted one each for latest 4 erlang releases,
(R15, R16, 17, 18), each with different variant, following the best
practices from docker official images guideline, should end up with
full feature while relatively slim images:
https://github.com/docker-library/official-images

1. the standard variant erlang:18, erlang:17, erlang:R16, erlang:R15
builds from source code, on top of
https://hub.docker.com/_/buildpack-deps/ :jessie, it covered gcc
compiler and some popular -dev packages, for port driver written in C;
while it doesn't have java compiler so out of the standard erlang-otp
provided 52 packages under /usr/lib/erlang/lib/... from this one odbc
/ jinterface / wxwidgets won't work, I assume to run GUI programs in
docker is not popular, so here we can save space; jinterface is
similar, the java dependencies are too fat, I assume demand is low;
2. the -onbuild variant for each erlang version, to utilize ONBUILD
instruction from Dockerfile, those are for starters
3. -esl variant is to pull erlang-solutions deb package to install on
top of debian:jessie, results in relatively slim image, but I am
trying to avoid wxwidgets / jinterface dependencies, reasons same as
above.

All these images are almost full featured Erlang-OTP images (except
wxwidgets & jinterface), you can run it like this once build locally
(or pull over docker hub if above PR can be merged),

$ docker run -it --rm erlang:18.1
Erlang/OTP 18 [erts-7.1] [source] [64-bit] [smp:8:8]
[async-threads:10] [hipe] [kernel-poll:false]

Eshell V7.1  (abort with ^G)
1> uptime().                                          # the new
uptime() shell command since OTP 18
3 seconds
ok
2> application:which_applications().
[{stdlib,"ERTS  CXC 138 10","2.6"},
 {kernel,"ERTS  CXC 138 10","4.1"}]
3>
User switch command
 --> q
root@REDACTED:/# ls /usr/local/lib/erlang/lib/
asn1-4.0     cosProperty-1.2  edoc-0.7.17     gs-1.6    observer-2.1
 public_key-1.0.1 stdlib-2.6   xmerl-1.3.8 common_test-1.11
cosTime-1.2  eldap-1.2     hipe-3.13    orber-3.8    reltool-0.7
syntax_tools-1.7 compiler-6.0.1     cosTransactions-1.3
erl_docgen-0.4     ic-4.4    os_mon-2.4    runtime_tools-1.9.1
test_server-3.9 cosEvent-2.2     crypto-3.6.1  erl_interface-3.8
inets-6.0.1    ose-1.1    sasl-2.6 tools-2.8.1 cosEventDomain-1.2
debugger-4.1.1  erts-7.1     kernel-4.1     otp_mibs-1.1    snmp-5.2
typer-0.9.9 cosFileTransfer-1.2  dialyzer-2.8.1  et-1.5.1
megaco-3.18    parsetools-2.1  ssh-4.1 webtool-0.9 cosNotification-1.2
 diameter-1.11  eunit-2.2.11     mnesia-4.13.1  percept-0.8.11
ssl-7.1 wx-1.5
root@REDACTED:/# ls /usr/local/lib/erlang/lib/ | wc -l
50

Size:

$ docker images |grep ^erlang
erlang     18.1-esl            138c797adec7        5 days ago          286.9 MB
erlang     18.1                27ad0fc44644        5 days ago          741.5 MB
erlang     R16B03-1            e0deec5e1e72        6 days ago          740.2 MB
erlang     18.0.3              52d4a7a4a281        6 days ago          743.7 MB

Comments are welcome.


Thanks,



More information about the erlang-questions mailing list