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 https://deb.nodesource.com/setup_16.x | bash - &&
apt-get install -y nodejs &&
apt-get install -y wget &&
apt-get install -y gnupg &&
wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb &&
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

WORKDIR /app

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?


Dockerfile:10

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

12
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 https://deb.nodesource.com/setup_16.x | bash -

RUN apt-get install -y nodejs

RUN apt-get install -y wget

RUN apt-get install -y gnupg

RUN wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && 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

https://hub.docker.com/r/hexpm/elixir/tags?page=1&name=1.14.3-erlang-25.3-ubuntu

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

2 Likes