I have encountered some problems with dockerizing my rebar3 app. As I'm trying to run the app (after building) I receive an error /prod/bin/prod: line 272: /prod/erts-11.2.2.1/bin/erl: not found
This is my rebar.config:
{plugins, [rebar3_hex]}.
{deps, [
{cowboy, "2.6.0"},
{eredis, "1.3.3"},
{hackney, "1.17.4"},
{jiffy, "1.0.8"}
]}.
{shell, [
% {config, "config/sys.config"},
{apps, [gmm]}
]}.
{relx, [
{release, {prod, "0.0.1"}, [
sasl,
gmm
]}
]}.
{profiles, [{prod, [{relx, [
{dev_mode, false},
{include_erts, true},
{include_src, false},
{debug_info, strip}]}]
}]}.
And this is my Dockerfile
FROM erlang:23
RUN mkdir /buildroot
WORKDIR /buildroot
COPY src src/
COPY include include/
COPY rebar.config .
RUN rebar3 as prod release
FROM alpine
RUN apk add --no-cache openssl && \
apk add --no-cache ncurses-libs
COPY --from=0 /buildroot/_build/prod/rel/prod /prod
EXPOSE 8080
CMD ["/prod/bin/prod", "console"]
Do you have any ideas what might be the source of the problem?
Erlang does not compile into binary files, you still need the erlang runtime to be able to run the application, yet your final docker image is a fresh alpine install that doesn't have erlang installed
erlang:23
docker container is debian-based. I suspect that error is because the release is generated on a debian container but executed on an alpine container. Generate the release from erlang:23-alpine
-container.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.