Docker throws error for mix local.hex command

I have this docker file to run the project locally, when this command is run Step 11/30 : RUN mix local.hex --force. I got these errors.

 Error relocating /usr/local/lib/erlang/erts-13.0.4/bin/beam.smp: _ZSt28__throw_bad_array_new_lengthv: 
 symbol not found
 Error relocating /usr/local/lib/erlang/erts-13.0.4/bin/beam.smp: pthread_getname_np: symbol not found

They don’t make any sense to me. Here is my Dockerfile.

FROM jrottenberg/ffmpeg:4.4-alpine AS FFmpeg
FROM elixir:1.13-otp-25-alpine

COPY --from=FFmpeg / /

ENV LANG="en_US.UTF-8" \
 LC_CTYPE="en_US.UTF-8" \
 LC_ALL="en_US.UTF-8" \
 AWSCLI_VERSION="1.16.205" \

RUN apk update && apk add --no-cache git postgresql-client openssl openssl-dev make imagemagick 
python3 \
python3-dev \
py-pip \
RUN wget$DOCKERIZE_VERSION/dockerize- 
alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
 && tar -C /usr/local/bin -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
 && rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz

RUN adduser -D -u 1000 slamchat
USER slamchat
RUN pip install awscli==$AWSCLI_VERSION --upgrade --user
COPY . .

RUN mix local.hex --force
RUN mix local.rebar --force
RUN mix do compile
CMD ["iex", "-S", "mix", "phx.server"]

Any help would be much appreciated.

Just an idea, but you might be missing something from your base image. For example, I include build-essential in my base images for compiling.

Sorry it’s not an exact answer.

1 Like

This looks really fishy, not only you are pulling from 2 images but are also outright replacing system binaries after extracting an archive.

Is this really the best way? I’d go for one of the hexpm Docker images for Erlang/Elixir and just add ffmpeg via the package manager. Sounds like much less things can go wrong.