Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Erlang OTP on Docker #1075

Merged
merged 1 commit into from
Nov 11, 2015
Merged

Support for Erlang OTP on Docker #1075

merged 1 commit into from
Nov 11, 2015

Conversation

c0b
Copy link
Contributor

@c0b c0b commented Sep 24, 2015

There is no official erlang images yet, I'm trying to make it happen; please let me know if any additional work need to do

+This is used as docker base image for Erlang OTP.
+
+One latest version for each of Last four major version: 18, 17, R16, R15 will be supported.

http://www.erlang.org/download.html

Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability.

@c0b
Copy link
Contributor Author

c0b commented Sep 24, 2015

I'm aware of https://hub.docker.com/r/correl/erlang/ which provides additional popular tools like rebar and relx, I will try to add them in more variants once this base can be merged.

@c0b
Copy link
Contributor Author

c0b commented Sep 24, 2015

docs PR at docker-library/docs#348 please review

@tianon
Copy link
Member

tianon commented Sep 28, 2015

Does it make sense to consider the pre-built packages hosted by Erlang Solutions, since they are officially recommended by upstream? I admit I don't know nearly enough about the Erlang ecosystem to know whether they're kept well up-to-date. One way of phrasing this that I find helpful is whether a production deployment of an Erlang project is recommended to be compiling Erlang from source, or whether it ought to be downloading pre-built packages from somewhere.

I'm also curious as to the number of versions supported here -- are these all still actively receiving updates/fixes upstream?

Additionally (as a final point from my initial review), I'm curious whether anyone from upstream is interested in being involved here (and if you've reached out to them, what their thoughts were)? 👍

@md5
Copy link
Contributor

md5 commented Sep 28, 2015

Back when I was working for Synctree and created the Dockerfiles over at synctree/docker-erlang, I had some interaction with some folks over at Erlang Solutions Limited regarding their *.deb packages. I'll see if I can dig up who I was working with and cc them here.

@md5
Copy link
Contributor

md5 commented Sep 28, 2015

Looks like I was working with @dexsda

@c0b
Copy link
Contributor Author

c0b commented Sep 30, 2015

that's on my schedule, I just made erlang:18-esl variant, to pull install the binary erlang-18.1 deb package from erlang-solutions install on to debian:jessie, which results a smaller image,

https://github.com/c0b/docker-erlang-otp/blob/master/18/esl/Dockerfile

$ 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

@c0b
Copy link
Contributor Author

c0b commented Sep 30, 2015

I have researched some existing effort like this list, looks like many ones are already on this just haven't communicated yet

  1. https://hub.docker.com/r/correl/erlang/
    this might be the earliest and 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;
  2. 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
  3. 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 provided 5 packages (compared a full erlang-otp has 52 lib
    packages under /usr/lib/erlang/lib/...)
    http://dl-4.alpinelinux.org/alpine/edge/main/x86_64/ (search erlang)
    this one also provided elixir images in different Dockerfile,
    presumably also slim but not full featured;
  4. 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
  5. 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, my goal is to provide images for a few last erlang releases (the last 4), close to full feature erlang, and relatively slim images;
before this 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 maintained 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,

$ 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
$ docker run -it --rm erlang:18.1 /bin/bash
root@6d2c1ad52ae8:/# 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@4cfd3172e8cc:/# 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.

@c0b c0b force-pushed the master branch 6 times, most recently from f7c6d70 to 090afd0 Compare October 2, 2015 06:29
@c0b c0b closed this Oct 2, 2015
@c0b c0b reopened this Oct 2, 2015
@c0b
Copy link
Contributor Author

c0b commented Oct 4, 2015

there are not much discussions yet, while I got -esl variant:

$ docker images |awk 'NR == 1 || /^erlang/'
REPOSITORY         TAG                 IMAGE ID            CREATED          VIRTUAL SIZE
erlang             18.1-esl            9140e1a9913e        3 days ago       286.9 MB
erlang             18.1                f4ea1ad78f3f        3 days ago       741.5 MB
erlang             R16B03-1            46fe912a808c        3 days ago       737.9 MB
erlang             17.5                5b01e12ab52e        3 days ago       741 MB
erlang             18.0.3              52d4a7a4a281        10 days ago      743.7 MB

http://erlang.org/pipermail/erlang-questions/2015-October/thread.html#86266

@c0b
Copy link
Contributor Author

c0b commented Oct 7, 2015

/cc @rvirding hi Robert, could you comment here? as Compile from erlang-otp source code, vs install binaries from erlang-solutions, what is the preferred way?

@c0b
Copy link
Contributor Author

c0b commented Oct 9, 2015

when Robert Virding comes here in LA in this week for a training as Principal Language Expert @ Erlang Solutions I had a little conversation asked him to comment on this, while he may not have time to comment here, I just quote his words when I asked "Compile from erlang-otp source code, vs install binaries": /cc @rvirding

"Erlang Solutions provide pre-packaged erlang binary packages for most of the popular OS / Distributions it's convenient to use; while if you want more flexibility, sure you can also compile from source code"

[1] https://www.erlang-solutions.com/about/news/erlang-solutions-announces-appointment-robert-virding-principal-language-expert
[2] https://packages.erlang-solutions.com/erlang/ has pre-packaged binaries for Ubuntu, CentOS, Mac OS X, Debian, Windows, Fedora, Raspbian, as well as the source tar ball for each release.

@tianon
Copy link
Member

tianon commented Oct 13, 2015

That sounds to me like we don't gain much by compiling from source in this case? 😄 👍

@c0b
Copy link
Contributor Author

c0b commented Oct 14, 2015

Comparing to Python and Golang, python docker is always compiling from source code, because python.org not providing precompiled binaries (for Linux), while golang docker is installing binaries from golang.org if because that language team is officially providing in binaries;

  1. https://hub.docker.com/_/python/
  2. https://hub.docker.com/_/golang/

I think here it's the same, erlang.org doesn't provide precompiled binaries either; although the commercial Erlang-Solutions Inc provided good binaries, but compile from source code still has the benefits of flexibility and support in time. have gcc in the image would be good for linkedin drivers written in C.

@vovimayhem
Copy link

Hi @c0b! I'm an Erlang/Elixir newbie "since today" :) @tianon redirected me back to this discussion.

Is it common for Erlang-based projects to use old Erlang releases (R15, R16)?

@vovimayhem
Copy link

At the moment, the erlang version at the apt repo (from packages.erlang-solutions.com) doesn't seem to be up to date with [https://github.com/erlang/otp/releases]...

This make the case for building from source, doesn't it? It would be very convenient to just install 'erlang-nox' from the debian repo, but again, it doesn't seem to be up to date.

@vovimayhem
Copy link

@c0b: Sent you a PR: "Feature: Improved variant names and builds", which should help :)

@c0b
Copy link
Contributor Author

c0b commented Nov 7, 2015

I agree, I can remove R15 / R16 from library/erlang in this PR and update docs PR. provide one last release for 17/18 each only.

@c0b c0b force-pushed the master branch 2 times, most recently from d21a53c to f63ba4e Compare November 7, 2015 19:49
@vovimayhem
Copy link

@c0b What happened to the LANG env var? I recall read somewhere that everything goes to funk if isn't set... but I'm not sure...

@c0b
Copy link
Contributor Author

c0b commented Nov 8, 2015

in my elixir implementation, that is the one really requiring utf-8, otherwise would give a warning; but the default erlang doesn't require that, the erlang default encoding is latin1 I think, and it works fine without LANG.


17.5.6.4: git://github.com/c0b/docker-erlang-otp@7a86ea4d35b99d1c40a9f2fe1470615e096c952a 17
17.5: git://github.com/c0b/docker-erlang-otp@7a86ea4d35b99d1c40a9f2fe1470615e096c952a 17
17: git://github.com/c0b/docker-erlang-otp@7a86ea4d35b99d1c40a9f2fe1470615e096c952a 17
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR is updated with one last version for 18 / 17 release only.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to bump this one more time before we merge to include some of these other changes? erlang/docker-erlang-otp@7a86ea4...master

@vovimayhem
Copy link

Coo �@c0b :) I was about to make another PR with rebar on it, but you already nailed it :)

@yosifkit
Copy link
Member

yosifkit commented Nov 9, 2015

The Dockerfiles look fine to me. And it looks like you contacted upstream on the mailing list, but there was not much response. It might be interesting if msaraiva wanted to join you in maintaining the images with his slim ones based on Alpine Linux or maybe those should be part of the Elixir discussion (up to you, but he seems to be already maintaining them and it might be useful to users).

LGTM, Build test of #1075; f63ba4e (erlang):

$ url="https://raw.githubusercontent.com/docker-library/official-images/f63ba4e28455b6143a8a7478e52e92828eab654a/library/erlang"
$ bashbrew build "$url"
Cloning erlang (git://github.com/c0b/docker-erlang-otp) ...
Processing erlang:18.1.3 ...
Processing erlang:18.1 ...
Processing erlang:18 ...
Processing erlang:latest ...
Processing erlang:17.5.6.4 ...
Processing erlang:17.5 ...
Processing erlang:17 ...
$ bashbrew list --uniq "$url" | xargs test/run.sh
testing erlang:18.1.3
    'utc' [1/4]...passed
    'cve-2014--shellshock' [2/4]...passed
    'no-hard-coded-passwords' [3/4]...passed
    'override-cmd' [4/4]...passed
testing erlang:17.5.6.4
    'utc' [1/4]...passed
    'cve-2014--shellshock' [2/4]...passed
    'no-hard-coded-passwords' [3/4]...passed
    'override-cmd' [4/4]...passed

@vovimayhem
Copy link

/cc @msaraiva

@msaraiva
Copy link

It might be interesting if msaraiva wanted to join you in maintaining the images with his slim ones based on Alpine Linux

It sounds interesting but there's a couple of things we should have in mind:

  • As I said on the mailing list, as far as I know, the OTP team doesn't build/test Erlang against musl libc. The build process, as it is right now, requires some patching. Is it ok for an official image to be based on a patched source code?
  • The images I maintain were originally designed to be as minimal as possible, so the user can choose later which erlang libraries should be installed according to his/her needs. Is this the approach we should have for the official image?

@c0b
Copy link
Contributor Author

c0b commented Nov 10, 2015

sure it should be shared maintained, if this can be merged and create a repo under https://github.com/docker-library/ that would be awesome.

link to musl libc is not what I am familiar. are there many docker images using it, and looks like its main consideration is code size, and targeting is embedded area? are there many success stories outside of embedded area, and how about mature level / compatibility review / performance benchmark comparison to other libc implementations
http://www.musl-libc.org/manual.html

for an official image for study purpose, may be still better to link with default glibc?

@tianon
Copy link
Member

tianon commented Nov 10, 2015

There are a number of images that have slim variants that are intended to be more minimal (not quite as minimal as alpine, but node is discussing an explicit alpine variant). I'd be wary of major upstream patching, since it'll ultimately be unsupported by upstream.

@tianon
Copy link
Member

tianon commented Nov 10, 2015

(more directly, I agree with @c0b that for now, we should probably stick to glibc and think about alpine as a potential future endeavor)

@msaraiva
Copy link

I agree with @tianon. For now, it's better to stick with glibc for the official image.

@c0b c0b force-pushed the master branch 2 times, most recently from ec79293 to 862b66d Compare November 11, 2015 00:01
One latest version for each of Last two major releases supported,
right there are 18.1, 17.5 from erlang otp releases:
https://github.com/erlang/otp/releases
@c0b
Copy link
Contributor Author

c0b commented Nov 11, 2015

updated docker-erlang-otp/blob/master/18/Dockerfile for better /var/lib/apt/* cleanup and commit ids here in library/erlang

@yosifkit
Copy link
Member

LGTM, Build test of #1075; 51334cd (erlang):

$ url="https://raw.githubusercontent.com/docker-library/official-images/51334cd945f4a94a07ca6d79702a902ff39f914a/library/erlang"
$ bashbrew build "$url"
Fetching erlang (git://github.com/c0b/docker-erlang-otp) ...
Processing erlang:18.1.3 ...
Processing erlang:18.1 ...
Processing erlang:18 ...
Processing erlang:latest ...
Processing erlang:17.5.6.4 ...
Processing erlang:17.5 ...
Processing erlang:17 ...
$ bashbrew list --uniq "$url" | xargs test/run.sh
testing erlang:18.1.3
    'utc' [1/4]...passed
    'cve-2014--shellshock' [2/4]...passed
    'no-hard-coded-passwords' [3/4]...passed
    'override-cmd' [4/4]...passed
testing erlang:17.5.6.4
    'utc' [1/4]...passed
    'cve-2014--shellshock' [2/4]...passed
    'no-hard-coded-passwords' [3/4]...passed
    'override-cmd' [4/4]...passed

@tianon
Copy link
Member

tianon commented Nov 11, 2015

LGTM 👍

tianon added a commit that referenced this pull request Nov 11, 2015
Support for Erlang OTP on Docker
@tianon tianon merged commit fb00653 into docker-library:master Nov 11, 2015
@c0b
Copy link
Contributor Author

c0b commented Nov 11, 2015

Nice! then how about docker-library/docs#348 ? and what else I can do to make it appearing at ?
https://hub.docker.com/_/erlang/

@tianon
Copy link
Member

tianon commented Nov 11, 2015 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants