christo-ph

christo-ph

I am getting errors regarding shared libraries in my Debian docker container:

Error loading shared library libncursesw.so.6: No such file or directory (needed by /app/erts-12.2.1/bin/beam.smp)
Error loading shared library libz.so.1: No such file or directory (needed by /app/erts-12.2.1/bin/beam.smp)
Error loading shared library libstdc++.so.6: No such file or directory (needed by /app/erts-12.2.1/bin/beam.smp)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /app/erts-12.2.1/bin/beam.smmp)

Even though I do have all dependencies installed AFAIK:

    apt install -y \
      openssl \
      libncursesw6 \
      libstdc++6 \
      libgcc-s1 \
      zlib1g \
      wget \
      musl-dev && \

For musl, I had to create a link as well:

ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1

The same procedure for the other libraries like this:

ln -s /lib/x86_64-linux-gnu/libncursesw.so.6 /lib/libncursesw.so.6

did not succeed.

Does anyone know where erlang/elixir looks for shared libraries? And, if I can add options to include the Debian library path /lib/x86_64-linux-gnu/?

Showing Posts 1 to 4

hubertlepicki

hubertlepicki

You’re doing something wrong and the problem is probably not a library resolution path, but the issue seems to be that the release is compiled on some other system than you run it on.

Do you have a 2-stage Dockerfile that builds the release and then runs it in a different image? i.e. one maybe is Alpine and the other is Debian?

Or are you building the release locally on a different system and then copying it to the Docker image?

Or maybe you are copying the _build directory from the parent system to the Docker image?

Somehow you end up with Erlang being compiled for a different system that it runs on.

christo-ph

christo-ph OP

I was assuming the same thing, as I moved from alpine to Debian.

To make sure, this is not the case, I tested it with the build image itself. The same error appears here when copying it to the target (same) container.

I build the image in an Debian container with elixir/erlang installed and copy everything to the runtime container (Debian slim without elixir/erlang):

FROM debian:bullseye-slim AS app

RUN \
    apt update && \
    apt install -y \
      openssl \
      libncursesw6 \
      libstdc++6 \
      libgcc-s1 \
      zlib1g \
      wget \
      bash \
      musl-dev && \
    ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1 

WORKDIR /app

RUN chown nobody:nogroup /app

USER nobody:nogroup
COPY --chown=nobody:nogroup _build/prod/rel/my_app ./

ENV HOME=/app
CMD ["bin/my_app", "start"]
DonHubi

DonHubi

Hi @christo-ph

It depends on the base image that you are using. Check out the following links as a good starting point for your elixir based docker file:

https://github.com/nickjj/docker-phoenix-example

HTH

christo-ph

christo-ph OP

I am using now the official elixir (slim) images, instead of compiling erlang/elixir directly. This works for the moment.

Still have to find the reason why my own pipeline fails here.

Thank you @hubertlepicki and @DonHubi

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
itzmidinesh
Hi all, I’m working on a Phoenix project where I need to make external HTTP requests and I’m trying to choose between Req and HTTPoison....
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
leoschweizer
Hi, we run different LLM models across a cluster, with each node loading a configurable subset. Model-specific queues let nodes consume ...
New
csmr
Hi all, I’m new here and would like to hear peoples views on my Elixir/Phoenix based game-engine! :smiley: Mutonex gamedesign was finish...
New
Stef-Verniers
Hello I’ve been coding in Elixir for almost two years now because of my current job where we implemented Elixir in our application. But ...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews