christo-ph

christo-ph

Deployment in docker: where does elixir look for shared libraries?

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/?

Marked As Solved

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

Also Liked

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

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

Where Next?

Popular in Questions Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

We're in Beta

About us Mission Statement