Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Docker build: /make: Permission denied

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

/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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading