godmaire
Erlexec not found when running app in Docker
Just started working with Elixir a month or so ago and am trying to package an application in Docker for the first time. It builds perfectly fine, but it crashes when ran with the following error:
/opt/sergei/releases/0.1.0/../../erts-13.1.3/bin/erl: exec: line 12: /opt/sergei/erts-13.1.3/bin/erlexec: not found
I’ve shelled into the docker container; the file does exist.
Here’s my Dockerfile
FROM elixir:alpine AS build_stage
# Config
ENV MIX_ENV prod
WORKDIR /opt/build
# Dependendies
COPY mix.* ./
COPY config ./config
RUN mix local.hex --force && \
mix local.rebar --force && \
mix deps.get --only prod && \
mix deps.compile
# Build project
COPY . .
RUN mix release sergei
FROM alpine:latest
WORKDIR /opt/sergei
COPY --from=build_stage /opt/build/_build/prod/rel/sergei /opt/sergei
ENTRYPOINT ["/opt/sergei/bin/sergei"]
CMD ["start"]
Trending in Questions
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
Using Phoenix.LiveView.TagEngine as an EEx.Engine is deprecated!
To compile HEEx, use Phoenix.LiveView.TagEngine.compile/2 instead.
Sta...
New
Hello !
We want new/edit form pages to POST/PUT to their own URL rather than the resources REST defaults (post /things, put /things/:id)...
New
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app?
Looking for hints regarding:
Addi...
New
Hi all, I wanted to ask how the community is dealing with post-release steps.
Today we have Ecto migrations, which make sure that the db...
New
I am using Oban and occasionally, shortly after a deployment, a handful of jobs can fail because of dependency on other parts of the syst...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #performance
- #security











First 5 of 5 Posts
ollien
I did some work to reproduce this locally and while I can’t prove it exactly, I’m willing to bet that there’s a versioning difference between
elixir:alpineandalpine:latest. If I change the secondFROMstatement toelixir:alpine, it works fine. I’ll do some more digging (because I’m curious), but that seems like a plausible reason to me. Not sure why you’re getting a “no such file or directory” error, though.ollien
I think I know the problem here.
alpineusesmuslOOTB, while most others useglibc. I cannot reproduce your problem exactly (the only way I was able to do so was by setting thebuild_stageFROM toelixir, which is actually Debian based), however, in that situation, I was able to do some poking. If Istraceerlexec– since as you point out, it does exist – I see the followingLooking at the man page for
execve, ENOENT can actually be returned under two situations. One, if the executable doesn’t exist, or two, if the loader doesn’t exist for that ELF binary (see here https://stackoverflow.com/questions/5234088/execve-file-not-found-when-stracing-the-very-same-file).What I suspect is going on (but is hard to pin down given I can’t fully recreate your problem) is that
glibcis being brought into your container somehow (are you perhaps copying_buildfrom your local machine when you build the release? it may be worth adding that to.dockerignore), which is causing you problems when you move onto a glibc-less system (i.e.alpine:latest). When I build the release onelixir:alpine, I see thaterlexecis correctly linked tolibmuslgodmaire
This was the issue, thank you so much!
ventsyv
Running into the same issue. The app builds in alpine, but when I move it to ubi (redhat) docker image I get
I compiled and installed musl libc so it’s resolved correctly:
There is no “_build” directory, but the issue is still there. I even tried copying the library from the alpine container, but that did not do anything.
Host machine is Ubuntu 22.04.
The original answer seems to suggest that it’s due to incompatible binary format. I don’t understand how the alpine based container works, but the UBI9 one doesn’t ?
Any ideas?
ventsyv
After some research, it appears that the alpine binaries are just not compatible with not alpine distros. I switched to compiling the app from source using elixir:latest (and updating node and npm) instead of trying to copy the compiled app from the alpine image.
This seems to have solved the problem.