ericmj

ericmj

Elixir Core Team

Yet another Elixir and Erlang docker image

The Hex team has been working on building our own Elixir and Erlang Docker images. We think they can be useful for the general community so I am sharing them in this post. The images are built by Bob which is the build service that provides the builds when you use Travis CI, GitHub CI, asdf, and other tools and services.

The reason we are building our own Docker images is because we have identified and run into a few issues with the existing image offerings that we are hoping to address with these images.

Issues with existing offerings

To sum it up:

  1. Image tags are not immutable
  2. Delay in availability of new versions
  3. Cannot pick the combination of versions you want

Our main issue is that image tags are not immutable. If you pull the image elixir:1.9.4 you do not know which Erlang version or OS version you are getting. This is specially a problem when the tag the image points to changes to update the Erlang version. Recently Erlang introduced a breaking change in a minor version that made it an error when you started a client side SSL connection with the honor_cipher_order option, the Elixir image was updated to the new Erlang version which caused hackney to break and our deploys stopped working without any changes to either our dependencies or our Dockerfile.

The images we build with Bob are immutable and the versions used are explicit. An example of an Elixir image tag is 1.10.0-erlang-22.2.4-alpine-3.11.3, here we can see that the Elixir, Erlang and Alpine versions are explicit and there is no reason to update any versions behind the scenes.

Sometimes there are delays in the availability of images for new releases. As I am writing this the new images for Elixir 1.10.0 are not yet available on the official Docker images even though 1.10.0 was released 3 days ago. The images from Bob are built automatically and should be available within 30 minutes of tagged releases.

Our final issue has been that we cannot pick the exact versions we want. From the official images I can install Elixir 1.9.4 but I have no idea what Erlang or OS version will be used. Sometimes we want to use the latest features from Erlang or stay on an older version for stability but this is not an option. The images from Bob are built with all compatible versions of the underlying OS, Erlang, and Elixir.

Possible downsides with Bob’s images

First off, they are currently experimental. This means you should take care before running them in production. We are running them in production for all Hex services without issue so far. While they are experimental the immutability guarantee of image tags may not hold if we find issues that require such changes.

We currently only provide images on the latest Alpine versions. In the future we may build on more systems.

Since we build for all compatible OS, Erlang, and Elixir versions we produce many, many images that use up disk spaces. We haven’t run into any limitations on DockerHub yet, but it is possible we do in the future. As far as I can tell there are no documented limitations.

To build the images faster we use the pre-compiled versions of Erlang and Elixir that Bob already provides. Because of this the original Makefiles are not available so we cannot use make install to install files in the correct locations. Currently we install Elixir and Erlang in the root of the filesystem at /elixir and /erlang respectively. This is obviously not ideal so if anyone has a solution to this problem we are all ears.

Links

To read more about Bob’s docker images go to our README: GitHub - hexpm/bob: The Builder · GitHub. Links to the DockerHub repositories can be found here: hexpm/erlang - Docker Image and here: hexpm/elixir - Docker Image.

First Post!

Phillipp

Phillipp

Nice! How about versions for ARM, so we can easily use it on a Raspberry Pi?

Most Liked

ericmj

ericmj

Elixir Core Team

We have added images based on Ubuntu LTS versions. They are based on the following image tags:

  • ubuntu:bionic-20200219
  • ubuntu:xenial-20200212
  • ubuntu:trusty-20191217

Example tags:

  • hexpm/erlang:22.2.8-ubuntu-bionic-20200219
  • hexpm/elixir:1.10.2-erlang-22.2.8-ubuntu-xenial-20200212

We also solved the issue of installing into the root of the filesystem in /erlang and /elixir by not using the precompiled builds and instead use make install to install in the correct locations according to the Filesystem Hierarchy Standard.

Next we are planning to add debian images. We also want to provide images for ARM architectures, but since we are no longer using the precompiled builds the option of cross-compiling is not possible. This means we either have to emulate ARM or use ARM hardware. I have tested the emulation option using docker buildx, but it seems far too slow, and we currently do not have access to ARM machines.

ericmj

ericmj

Elixir Core Team

We have added builds based on debian and based on the ARM v8 architecture (called arm64 on Docker). The new debian images are based on the following image tags:

  • debian:buster-20200224
  • debian:stretch-20200224
  • debian:jessie-20200224

We use “fat manifests” to be able to serve both amd64 and arm64 using the same image tag names, that means you can docker pull hexpm/erlang:22.3-alpine-3.11.3 and docker will figure out the correct architecture to pull for your system. We provide arm64 images for all the same versions we provide amd64 images as long as we are able to build Erlang and Elixir on the given versions, but some older distributions and Erlang versions do not fully support ARM.

entone

entone

The “not immutable” image tags have bitten me/us several times. Excited for officially supported community versions. Great work!

Where Next?

Popular in Discussions Top

ricklove
I was just introduced to Elixir and Phoenix. I was told about the 2 million websocket test that was done 2 years ago. From my research, t...
New
restack_oslo
Hello, Please pardon me for any faux paux. I am 46 and this is my first time on a forum of any kind. I wanted to to get answers from tho...
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
wmnnd
The Go vs Elixir thread got me thinking: Would it be too hard to implement a simple mechanism for creating Go-style static app binaries f...
New
chulkilee
Here are the list of HTTP client libraries/wrappers, and some thoughts on HTTP client in general. I’d like to hear from others how they w...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40165 209
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New

We're in Beta

About us Mission Statement