Getting error when trying to install elixir in docker

Use Ubuntu as base image

FROM ubuntu:latest

Install required dependencies for Elixir

RUN apt-get update &&
apt-get install -y curl &&
curl -sL | bash - &&
apt-get install -y nodejs &&
apt-get install -y wget &&
apt-get install -y gnupg &&
wget &&
dpkg -i erlang-solutions_2.0_all.deb &&
apt-get update &&
apt-get install -y esl-erlang elixir=1.12.3-1

Set working directory


Copy your Elixir application code to the container

COPY . .

Compile your Elixir application

RUN mix compile

Start your Elixir application

CMD [“mix”, “run”]

I am getting error in RUN. Can you please help if i want to install elixir v1.12.3

Can you paste the error?


8 | RUN apt-get install -y gnupg
9 | RUN wget && dpkg -i erlang-solutions_2.0_all.deb
10 | >>> RUN apt-get install erlang
11 | RUN apt-get install elixir

ERROR: failed to solve: process “/bin/sh -c apt-get install erlang” did not complete successfully: exit code: 1

this is the new dockfile
FROM ubuntu:latest

RUN apt-get update

RUN apt-get install -y curl && \

curl -sL | bash -

RUN apt-get install -y nodejs

RUN apt-get install -y wget

RUN apt-get install -y gnupg

RUN wget && dpkg -i erlang-solutions_2.0_all.deb

RUN apt-get install erlang

RUN apt-get install elixir

WORKDIR /home/jill/main/Pod/elixir_app

COPY . .

RUN mix compile

CMD [“mix”, “run”]

Worked for me… maybe you’re forgetting -y, i.e…

RUN apt-get install -y erlang

Also, why build/install yourself? There are ready to use Docker images with most ErlangOTP/Elixir/OS combos.

For example, hexpm/elixir:1.14.3-erlang-25.3-ubuntu-jammy-20230126

An aside, I can’t believe how bad Docker Hub’s search tag feature is. It’s terrible.

1 Like