Trivial Elixir app: release build runs but docker runtime error from erlexec

I have an absolutely empty elixir 1.10.2 app that once I’ve done
mix release.init
<fix-up config files>
MIX_ENV=prod mix release
and finally:
_build/prod/rel/sock_app/bin/sock_app start

The application builds and runs fine. But when I dockerize it,

docker build -t sock_app .

and do:

docker run -p 4004:4004 sock_app

I immediately get the runtime error:

/app/erts-10.6.1/bin/erlexec: line 1: syntax error: unexpected "("

I’ve re-written the Dockerfile a few times but always end-up with this error.

Any ideas? The code can be found at: https://github.com/mazz/sock_app

I had similar problems recently. I think it may have to do with things getting compiled on the host machine and leaking into the Docker container causing problems. I would try creating a .dockerignore and adding things like _build/, deps, and anything else that isn’t actually required to build the app to make sure nothing that got build on your host machine leaks in to the container. Since Alpine uses MUSL that would cause problems. Definitely ignore those two at least.

Similar problem: https://github.com/bitwalker/exrm/issues/35

1 Like

That was it! Nice one, thanks.

Pushed it to the repo if anyone is interested.

3 Likes