How does one lock down a certain version of Erlang?



Hi CircleCI friends,

Working on this elixir project that’s using v2.0, I’m using .tool-versions to lock down the elixir and erlang versions that the project is depending on.

Here is an example:

$ cat .tool-versions
elixir 1.6.2-otp-20
erlang 20.2.3

As part of CI, there’s a job in the workflow that’s running dialyzer (through dialyxir) and caches the built PLTs with a key that’s depending on

  • checksum ".tool-versions" and
  • checksum "mix.lock"

These (cached?) PLTs are built based on the version of elixir and erlang that are used in the project.

Recently I noticed that the dialyzer job was constantly not taking “less time”, as expected from using cache:


The interesting observation was that the elixir 1.6.1 image

      - image: elixir:1.6.1

had switched under us from using erlang 20.2.3 to using erlang 20.2.4:

This leaves the door open to unexpected behaviour, methinks.

Upon updating the project to use erlang 20.2.4, subsequent job times started fitting the expectations again:

Now, I understand that .tool-versions is not something supported by CircleCI 2.0, but is seems that the image directive is not sufficient in this case.

Or is there a way to specify the elixir docker image such that locks down the erlang version as well?

PS: There’s no elixir tag (and I cannot create one) that can be used for this post, is there? :smiley:


Yep. Create a custom Docker image locked down to the versions of things you want, based on a blank OS parent (e.g. Ubuntu, Alpine, etc). Then you can specify this in your docker key in your YAML config.

Or, if you want, you can just specify a plain image in your YAML config and do install commands for the exact versions of things you need. I don’t know how to do that for Erlang, but here’s how I do it for DC:

  - run:
      name: Install Docker Compose
      command: |
        set -x
        apk --update add 'py-pip==9.0.0-r1'
        pip install 'docker-compose==1.13.0'

Which you should go for depends on whether it is quicker to install software or pull images, which varies a lot between cases.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.