I'm having problems trying to build an image with erlang 26 compiled from source, when I run docker build .
I get
=> ERROR [ 7/14] RUN /home/erl/otp_src_26.0.2/make 0.3s
------
> [ 7/14] RUN /home/erl/otp_src_26.0.2/make:
#0 0.244 /bin/sh: 1: /home/erl/otp_src_26.0.2/make: Permission denied
------
Dockerfile:53
--------------------
51 |
52 |
53 | >>> RUN /home/erl/otp_src_${ERLANG_VERSION}/make
54 |
55 | RUN /home/erl/otp_src_${ERLANG_VERSION}/make install && \
--------------------
ERROR: failed to solve: process "/bin/sh -c /home/erl/otp_src_${ERLANG_VERSION}/make" did not complete successfully: exit code: 126
I've tried setting root user with USER root
, using make 4.2
and chmod 777
the entire folder but nothing changes. I can follow the same steps on my local machine and they work.
Before this i was using https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb
but they doesn't provide the last versions.
I know i can use the official image, but I like to do it this way first
Here is the Dockerfile
FROM ubuntu:22.04
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8
ENV ERLANG_VERSION 26.0.2
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends \
ca-certificates \
git \
gnupg \
inotify-tools \
make \
gcc \
libssl-dev \
libncurses-dev \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install Erlang
RUN wget -P /home/erl https://github.com/erlang/otp/releases/download/OTP-${ERLANG_VERSION}/otp_src_${ERLANG_VERSION}.tar.gz && \
tar -xf /home/erl/otp_src_${ERLANG_VERSION}.tar.gz -C /home/erl
RUN /home/erl/otp_src_${ERLANG_VERSION}/configure
RUN /home/erl/otp_src_${ERLANG_VERSION}/make
RUN /home/erl/otp_src_${ERLANG_VERSION}/make install && \
rm -r /home/erl
WORKDIR /app
/home/erl/otp_src_${ERLANG_VERSION}/make
is a directory and so you get the cryptic message 'Permission denied' when you try to run it.
The make
executable isn't located in the Erlang directory. It's installed in /usr/bin
. Make assumes that you're running it from the directory where your project is located.
Instead of
RUN /home/erl/otp_src_${ERLANG_VERSION}/configure
RUN /home/erl/otp_src_${ERLANG_VERSION}/make
RUN /home/erl/otp_src_${ERLANG_VERSION}/make install && \
rm -r /home/erl
you can cd
into the directory and run the commands you need. Like this
RUN cd /home/erl/otp_src_${ERLANG_VERSION} && \
./configure && \
make && \
make install && \
cd / && \
rm -r /home/erl