nietaki

nietaki

Workaround for Docker with Erlang/OTP 21.3

Just a quick heads up: There seems to be a bug in Erlang/OTP 21.3, which can cause some errors when making http requests. If you’re using the official Elixir images that use Erlang/OTP 21 it might affect your app, because they got rebuilt with the latest version that contains the bug.

The quickest workaround is to instead of using FROM elixir:1.7.4 in your Dockerfile, replicate the elixir image layer and point it to an earlier image, for example 21.2.7:

FROM erlang:21.2.7

# elixir expects utf8.
ENV ELIXIR_VERSION="v1.7.4" \
	LANG=C.UTF-8

RUN set -xe \
	&& ELIXIR_DOWNLOAD_URL="https://github.com/elixir-lang/elixir/archive/${ELIXIR_VERSION}.tar.gz" \
	&& ELIXIR_DOWNLOAD_SHA256="c7c87983e03a1dcf20078141a22355e88dadb26b53d3f3f98b9a9268687f9e20" \
	&& curl -fSL -o elixir-src.tar.gz $ELIXIR_DOWNLOAD_URL \
	&& echo "$ELIXIR_DOWNLOAD_SHA256  elixir-src.tar.gz" | sha256sum -c - \
	&& mkdir -p /usr/local/src/elixir \
	&& tar -xzC /usr/local/src/elixir --strip-components=1 -f elixir-src.tar.gz \
	&& rm elixir-src.tar.gz \
	&& cd /usr/local/src/elixir \
	&& make install clean

CMD ["iex"]

Posting it here, because I know it affected more than just myself, might save some of you some time.

Most Liked

shanesveller

shanesveller

The historical version of the official image that included OTP 21.2.6 can be obtained by referring to this image syntax:

elixir:1.8.1-alpine@sha256:f6a0647245a467f7affee2e635341eb40d4b9dee88467f3b14a30707dbd21308

This syntax is compatible with, among others, docker pull, docker run, FROM in a Dockerfile, and Kubernetes manifests. The checksum is output whenever you pull an image via the normal docker pull CLI, and is also available after the fact via docker inspect $imageID under the RepoDigests key.

You can bulk check your image tags and digests like this, which may catch historical copies that were untagged by a subsequent pull:

docker images elixir -q | xargs -n1 docker inspect | jq ".[] | { tag: .RepoTags[0], digest: .RepoDigests[0] }"
10
Post #4
engineeringdept

engineeringdept

Thanks - I got bit by this too. If you’re using Elixir 1.8.1, I made an image over here: https://hub.docker.com/r/tomtaylor/elixir (using this Dockerfile: https://github.com/poplarhq/elixir-docker-image)

shanesveller

shanesveller

This is part of why treating specific Docker image tags as mutable is so dangerous. When I’m in front of a computer I can check if I still have the correct SHA256 image checksums for the prior version that used OTP 21.2.x, because I pin them in my FROM lines after experiences similar to this.

garazdawi

garazdawi

Erlang Core Team

You need to look at either the erlang-questions or erlang-announce mailing list. Or you can just check here: OTP Versions Tree.

csoreff

csoreff

Oh man, this was driving me crazy for days. Thanks.

Where Next?

Popular in Guides/Tuts Top

hauks96
Hello everyone, I created a deployment tutorial for Phoenix applications with Kubernetes (microk8s) a few months back with the goal of s...
New
siever
I just wrote a simple guide on how you can setup a productive elixir development environment in vim. Its really easy, just a few steps. ...
New
kokolegorille
Hello dear alchemists, There was this question some days ago here about the deployment to a VPS. As I was in the process of deploying t...
New
nelsonic
Complete beginners Todo List Tutorial in Phoenix 1.5.3 (latest and greatest): It’s a feature complete TodoMVC clone with 0% JavaScri...
New
tomciopp
TLS 1.3 has been out for a little over a year now, but it has been unavailable in Phoenix due to erlang’s handling of ssl. With the most ...
New
Eiji
Hey, today I give amnesia library a try and found a few problems. I would like describe how to setup it properly and solve problems which...
New
jtormey
Hello! Having written a lot of LiveView code, I’ve made some VS Code snippets to speed up writing callbacks for LiveViews and LiveCompon...
New
TwistingTwists
This is a thread to note down things/best practices encountered in LiveBeats App as I explore the source code. Found this usage of r...
New
water
I’ll post this here, It might help someone in the future. Feedback is greatly appreciated. I use it with direnv on NixOS, It should wor...
New
fuelen
Hi all! Just want to share a small code snippet which allows writing CASE expressions using macro which is similar to cond. Here is an ...
New

Other popular topics Top

stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
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

We're in Beta

About us Mission Statement