<h1>Context</h1>
<p>Currently putting online for the first time an Elixir/Phoenix app on Google Cloud and Kubernetes, (I found a tutorial that I follow a tutorial =&gt; <a href="https://cloud.google.com/community/tutorials/elixir-phoenix-on-kubernetes-google-container-engine" rel="nofollow noreferrer">run an Elixir/Phoenix app in containers using Google Kubernetes Engine</a>), I'm getting stuck at what seems to be the last step : <a href="https://cloud.google.com/community/tutorials/elixir-phoenix-on-kubernetes-google-container-engine#deploy_to_the_cluster" rel="nofollow noreferrer">Deploy to the cluster</a> due to some error I haven't found a fix for.</p>
<h2>The app</h2>
<p>The elixir app is an <strong>umbrella app</strong> with two phoenix app, each one with a port (on for the admin website, the other for the general website) and three other elixir app.</p>
<p>There is a custom docker for dev (using docker-compose), and another <strong>Dockerfile for production</strong>, which is the following one (separated in two parts, I guess the first one is for the image building and the second is for kubernetes):</p>
<pre><code># prod.Dockerfile
FROM elixir:alpine

ARG app_name=prod
ARG phoenix_subdir=.
ARG build_env=prod

RUN apk add --no-cache make build-base openssl ncurses-libs libgcc libstdc++

ENV MIX_ENV=${build_env} TERM=xterm

WORKDIR /opt/app
RUN apk update \
  &amp;&amp; apk --no-cache --update add nodejs npm \
  &amp;&amp; mix local.rebar --force \
  &amp;&amp; mix local.hex --force
COPY . .

RUN mix do deps.get, compile
RUN cd apps/admin/assets \
  &amp;&amp; npm rebuild node-sass \
  &amp;&amp; npm install \
  &amp;&amp; ./node_modules/webpack/bin/webpack.js \
  &amp;&amp; cd .. \
  &amp;&amp; mix phx.digest

RUN cd apps/app/assets \
  &amp;&amp; npm rebuild node-sass \
  &amp;&amp; npm install \
  &amp;&amp; ./node_modules/webpack/bin/webpack.js \
  &amp;&amp; cd .. \
  &amp;&amp; mix phx.digest
RUN mix release ${app_name} \
  &amp;&amp; mv _build/${build_env}/rel/${app_name} /opt/release \
  &amp;&amp; mv /opt/release/bin/${app_name} /opt/release/bin/start_server


FROM alpine:latest

RUN apk add make build-base --no-cache openssl ncurses-libs libgcc libstdc++

ARG hello

RUN apk update \
  &amp;&amp; apk add --no-cache postgresql-client \
  &amp;&amp; apk --no-cache --update add  bash ca-certificates openssl-dev \
  &amp;&amp; mkdir -p /usr/local/bin \
  &amp;&amp; wget https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 \
  -O /usr/local/bin/cloud_sql_proxy \
  &amp;&amp; chmod +x /usr/local/bin/cloud_sql_proxy \
  &amp;&amp; mkdir -p /tmp/cloudsql
ENV GCLOUD_PROJECT_ID=${project_id} \
  REPLACE_OS_VARS=true
EXPOSE ${PORT}
EXPOSE 4011
WORKDIR /opt/app
COPY --from=0 /opt/release .
CMD (/usr/local/bin/cloud_sql_proxy \
  -projects=${GCLOUD_PROJECT_ID} -dir=/tmp/cloudsql &amp;); \
  exec /opt/app/bin/start_server start
</code></pre>
<p>Which is called by <code>cloudbuild.yaml</code>:</p>
<pre class="lang-yaml prettyprint-override"><code>steps:
- name: &quot;gcr.io/cloud-builders/docker&quot;
  args: [&quot;build&quot;, &quot;-t&quot;, &quot;gcr.io/hello/prod:$_TAG&quot;,
       &quot;--build-arg&quot;, &quot;project_id=hello&quot;, &quot;.&quot;,
       &quot;--file=./prod.Dockerfile&quot;]
images: [&quot;gcr.io/hello/prod:$_TAG&quot;]
</code></pre>
<h1>The steps</h1>
<p>(re)building the image</p>
<pre class="lang-sh prettyprint-override"><code>$&gt; gcloud builds submit --substitutions=_TAG=v1 .
</code></pre>
<p>Then create a deployment</p>
<pre class="lang-sh prettyprint-override"><code>$&gt; kubectl run hello-web --image=gcr.io/${PROJECT_ID}/hello:v1 --port 8080
pod/hello-web created
</code></pre>
<p>Check if the deployment went well (spoiler: it doesn't)</p>
<pre class="lang-sh prettyprint-override"><code>$&gt; kubectl get pods
NAME                  READY   STATUS             RESTARTS   AGE
hello-web   0/1     CrashLoopBackOff   1          15s
</code></pre>
<p>Check the log</p>
<pre class="lang-sh prettyprint-override"><code>$&gt; kubectl logs {POD-NAME}
</code></pre>
<p>Which display the following error:</p>
<h1>The error</h1>
<pre class="lang-sh prettyprint-override"><code>2021/08/09 23:49:15 current FDs rlimit set to 1048576, wanted limit is 8500. Nothing to do here.
2021/08/09 23:49:15 gcloud is not in the path and -instances and -projects are empty
Error loading shared library libstdc++.so.6: No such file or directory (needed by /opt/app/erts-12.0.3/bin/beam.smp)
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /opt/app/erts-12.0.3/bin/beam.smp)
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: __cxa_begin_catch: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZSt24__throw_out_of_range_fmtPKcz: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _Znwm: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZSt20__throw_length_errorPKc: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: __cxa_guard_release: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZNKSt8__detail20_Prime_rehash_policy11_M_next_bktEm: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: __popcountdi2: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZSt17__throw_bad_allocv: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_appendEPKcm: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9_M_createERmm: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZSt18_Rb_tree_incrementPKSt18_Rb_tree_node_base: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: __cxa_end_catch: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: __cxa_guard_acquire: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZNKSt8__detail20_Prime_rehash_policy14_M_need_rehashEmmm: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZSt19__throw_logic_errorPKc: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: __cxa_rethrow: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _Unwind_Resume: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZdlPvm: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
...
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZTVN10__cxxabiv120__si_class_type_infoE: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: __cxa_pure_virtual: symbol not found
...
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: __cxa_pure_virtual: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
...
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZTVN10__cxxabiv117__class_type_infoE: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: _ZTVN10__cxxabiv121__vmi_class_type_infoE: symbol not found
Error relocating /opt/app/erts-12.0.3/bin/beam.smp: __gxx_personality_v0: symbol not found
</code></pre>
<h1>What have I tried</h1>
<p>Though I know almost nothing, I still tried to modify a little bit the Dockerfile, without success. I also search on Google the libgcc error without any success.</p>
<p>That's about it, as I don't have clues were to look other than that.</p>
<p>So, any advises to make it works ?</p>
<h1>Other actions</h1>
<p>Delete the pod, then get the image's tags and clean it</p>
<pre class="lang-sh prettyprint-override"><code>$&gt; kubectl delete pod hello-web
$&gt; gcloud container images list-tags gcr.io/hello/prod
$&gt; gcloud container images delete gcr.io/hello/prod@sha256:...
</code></pre>
<h1>Edits</h1>
<h2>Edit 1 (12/08/2021 19:04)</h2>
<ul>
<li>Update the Dockerfile with the latest version of it</li>
<li>Add another action list</li>
</ul>
<p><strong>Result : nothing changed</strong></p>

Aridjar
<p>It looks like your question has been asked on the Elixir forums already:</p>
<p><a href="https://elixirforum.com/t/docker-run-error-loading-shared-library-libstdc-so-6-and-libgcc-s-so-1/40496" rel="nofollow noreferrer">https://elixirforum.com/t/docker-run-error-loading-shared-library-libstdc-so-6-and-libgcc-s-so-1/40496</a></p>
<blockquote>
<p>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++.</p>
</blockquote>
<p>The fix being to add <code>libstdc++</code> to your install line.</p>
<p>The reasoning for this is also outlined in the forum post:</p>
<blockquote>
<p>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.</p>
</blockquote>
<p>Best of luck!</p>
