romenigld

romenigld

Docker run Error loading shared library libstdc++.so.6 and libgcc_s.so.1

I am trying to run a deploy with docker and I successfully runned with this command:

docker build -t romenigld/blog-prod .

but when I tried to do with this command:

docker run --env-file .env -p 8080:4000 romenigld/blog-prod

I`m getting this error:

Error loading shared library libstdc++.so.6: No such file or directory (needed by /app/erts-12.0.2/bin/beam.smp)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /app/erts-12.0.2/bin/beam.smp)
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_begin_catch: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZSt24__throw_out_of_range_fmtPKcz: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _Znwm: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZSt20__throw_length_errorPKc: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_guard_release: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEm: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __popcountdi2: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZSt17__throw_bad_allocv: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_end_catch: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_guard_acquire: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZNKSt8__detail20_Prime_rehash_policy14_M_need_rehashEmmm: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZSt19__throw_logic_errorPKc: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_rethrow: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _Unwind_Resume: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZdlPvm: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: _ZTVN10__cxxabiv121__vmi_class_type_infoE: symbol not found
Error relocating /app/erts-12.0.2/bin/beam.smp: __gxx_personality_v0: symbol not found

My Dockerfile:

FROM elixir:alpine AS build

# install build dependencies
RUN apk add --no-cache build-base npm git python3

# prepare build dir
WORKDIR /app

# install hex + rebar
RUN mix local.hex --force && \
    mix local.rebar --force

# set build ENV
ENV MIX_ENV=prod

# install mix dependencies
COPY mix.exs mix.lock ./
COPY config config
RUN mix do deps.get, deps.compile

# build assets
COPY assets/package.json assets/package-lock.json ./assets/
RUN npm --prefix ./assets ci --progress=false --no-audit --loglevel=error

COPY priv priv
COPY assets assets
RUN npm run --prefix ./assets deploy
RUN mix phx.digest

# compile and build release
COPY lib lib
RUN mix do compile, release

# prepare release image
FROM alpine:3.9 AS app

RUN apk add --no-cache openssl ncurses-libs

WORKDIR /app

RUN chown nobody:nobody /app

USER nobody:nobody

COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/blog ./

ENV HOME=/app

CMD ["bin/blog", "start"]

my docker_dev_start.sh:

mix ecto.drop
mix ecto.setup
exec mix phx.server

my docker-compose.yml:

version: "3"
services:
  app:
    restart: on-failure # vai restartar na falha(outras opções [no, always, unless-stopped(quando força a ação)])
    build:
      context: .
      dockerfile: Dockerfile.dev
    command: /bin/sh docker_dev_start.sh
    ports:
      - "8080:4000"
    depends_on:
      - db
    links:
      - db
  db:
    restart: always
    image: postgres
    environment:
      POSTGRES_PASSWORD: postgres
      POSTGRES_USER: postgres
    ports:
      - "5432:5432"

Most Liked

joshdcuneo

joshdcuneo

It looks like a missing runtime dependency in your final image. Try changing RUN apk add --no-cache openssl ncurses-libs to RUN apk add --no-cache openssl ncurses-libs libstdc++.

LostKobrakai

LostKobrakai

The beam has native runtime dependencies and OTP 24 added libc as runtime dependency to support the JIT. With that change it seems like bare alpine:3.9 no longer brings all the required runtime dependencies. You’ll need to make sure that all of those those are present in the app container.

romenigld

romenigld

I asked in stackoverflow.
And put this:


# prepare release image 
FROM alpine:3.14 AS app 
RUN apk upgrade --no-cache && \ 
apk add --no-cache postgresql-client bash openssl libgcc libstdc++ ncurses-libs

and now worked for me. Thank you guys!

Where Next?

Popular in Questions Top

sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
jaysoifer
Is there a way to rollback a specific migration and only that one (“skipping” all the other ones)? Would mix ecto.rollback -v 200809061...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
yawaramin
In the Dialyzer docs ( dialyzer — OTP 29.0.2 (dialyzer 6.0.1) ), there is a way to turn off a specific warning for a function: -dialyzer...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Other popular topics Top

senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
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
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement