Repository navigation
is not posible to build docker ejabberd ecs on MacOS ? #124
Copy link
Copy link
Open
Description
hi
i tried to build ecs on my Mac
i wrote
sudo ./build.sh 25.03
this is my build.sh
#!/bin/sh
current=$(date +%y.%m)
version=${1:-$current}
docker build \
--build-arg VERSION=$version \
--build-arg VCS_REF=`git rev-parse --short HEAD` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
-t ejabberd/ecs:$version --platform linux/amd64 .
[ "$version" = "latest" ] || docker tag ejabberd/ecs:$version ejabberd/ecs:latest
i got this error message
11:50:23.723 [notice] Application hex exited: exited in: Hex.Application.start(:normal, [])
10.95 ** (EXIT) an exception was raised:
10.95 ** (MatchError) no match of right hand side value: 105
10.95 (elixir 1.15.7) src/elixir_def.erl:134: :elixir_def.store_definition/3
10.95 (mix 1.15.7) Mix.RemoteConverger.behaviour_info/1
10.95 (kernel 9.2) application_master.erl:293: :application_master.start_it_old/4
10.97
10.97 11:50:23.939 [notice] Application inets exited: :stopped
10.98
10.98 11:50:23.949 [notice] Application ssl exited: :stopped
10.98
10.98 11:50:23.949 [notice] Application public_key exited: :stopped
10.98
10.98 11:50:23.949 [notice] Application asn1 exited: :stopped
10.99
10.99 11:50:23.950 [notice] Application crypto exited: :stopped
11.00 Could not start Hex. Try fetching a new version with "mix local.hex" or uninstalling it with "mix archive.uninstall hex.ez"
11.01 ** (MatchError) no match of right hand side value: {:error, {:hex, {:bad_return, {{Hex.Application, :start, [:normal, []]}, {:EXIT, {{:badmatch, 105}, [{:elixir_def, :store_definition, 3, [file: ~c"src/elixir_def.erl", line: 134]}, {Mix.RemoteConverger, :behaviour_info, 1, []}, {:application_master, :start_it_old, 4, [file: ~c"application_master.erl", line: 293]}]}}}}}}
11.01 (hex 2.1.1) lib/hex.ex:5: Hex.start/0
11.01 (mix 1.15.7) lib/mix/hex.ex:60: Mix.Hex.start/0
11.01 (mix 1.15.7) lib/mix/dep/loader.ex:189: Mix.Dep.Loader.with_scm_and_app/5
11.01 (mix 1.15.7) lib/mix/dep/loader.ex:141: Mix.Dep.Loader.to_dep/4
11.01 (elixir 1.15.7) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
11.01 (mix 1.15.7) lib/mix/dep/loader.ex:364: Mix.Dep.Loader.mix_children/3
11.01 (mix 1.15.7) lib/mix/dep/loader.ex:18: Mix.Dep.Loader.children/1
11.01 (mix 1.15.7) lib/mix/dep/converger.ex:97: Mix.Dep.Converger.all/4
------
4 warnings found (use docker --debug to expand):
- LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 125)
- LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 126)
- LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 127)
- LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 128)
Dockerfile:19
--------------------
18 | COPY rel/*exs rel/
19 | >>> RUN git checkout ${VERSION/latest/HEAD} \
20 | >>> \
21 | >>> && if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then \
22 | >>> echo '{vsn, "'"$VERSION.0"'"}.' >> vars.config; \
23 | >>> else \
24 | >>> echo '{vsn, "0.0.0"}.' >> vars.config; \
25 | >>> fi \
26 | >>> \
27 | >>> && mix deps.get \
28 | >>> && (cd deps/eimp; ./configure)
29 |
--------------------
ERROR: failed to solve: process "/bin/sh -c git checkout ${VERSION/latest/HEAD} && if [[ \"$VERSION\" =~ ^[0-9]+\\.[0-9]+$ ]]; then echo '{vsn, \"'\"$VERSION.0\"'\"}.' >> vars.config; else echo '{vsn, \"0.0.0\"}.' >> vars.config; fi && mix deps.get && (cd deps/eimp; ./configure)" did not complete successfully: exit code: 1
Error response from daemon: No such image: ejabberd/ecs:25.03
but when i do the same on linux ubuntu i can build ecs successfully
so my question is if building ecs on Mac is not possible?
this is my Dockerfile
FROM docker.io/golang:1.22-alpine AS api
RUN go install -v \
github.com/processone/ejabberd-api/cmd/ejabberd@latest \
&& mv bin/ejabberd bin/ejabberdapi
FROM docker.io/ejabberd/mix AS builder
ARG VERSION
ENV VERSION=${VERSION:-latest} \
MIX_ENV=prod
LABEL maintainer="ProcessOne <contact@process-one.net>" \
product="Ejabberd Community Server builder"
# Get ejabberd sources, dependencies, configuration
RUN git clone https://github.com/processone/ejabberd.git
WORKDIR /ejabberd
COPY vars.config .
COPY config.exs config/
COPY rel/*exs rel/
RUN git checkout ${VERSION/latest/HEAD} \
\
&& if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+$ ]]; then \
echo '{vsn, "'"$VERSION.0"'"}.' >> vars.config; \
else \
echo '{vsn, "0.0.0"}.' >> vars.config; \
fi \
\
&& mix deps.get \
&& (cd deps/eimp; ./configure)
# Compile
RUN MIX_ENV=prod mix release
# Prepare runtime environment
RUN mkdir runtime \
&& tar -C runtime -zxf _build/prod/ejabberd-*.tar.gz \
&& cd runtime \
&& cp releases/*/start.boot bin \
&& cp releases/*/start_clean.boot bin \
&& echo 'beam_lib:strip_files(filelib:wildcard("lib/*/ebin/*beam")), init:stop().' | erl >/dev/null \
&& mv erts*/bin/* bin \
&& EJABBERD_VERSION=`(cd releases; ls -1 -d *.*.*)` \
&& rm -rf releases erts* bin/*src bin/dialyzer bin/typer etc \
&& rm bin/ejabberd \
&& mkdir lib/ejabberd-$EJABBERD_VERSION/priv/bin \
&& cp /usr/lib/elixir/bin/* bin/ \
&& sed -i 's|ERL_EXEC="erl"|ERL_EXEC="/home/ejabberd/bin/erl"|' bin/elixir \
&& cp /ejabberd/tools/captcha*sh bin/ \
&& cp -r /ejabberd/sql lib/ejabberd-*/priv
# Runtime container
FROM docker.io/alpine:3.19
ARG VERSION
ARG VCS_REF
ARG BUILD_DATE
ENV TERM=xterm \
LC_ALL=C.UTF-8 \
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
REPLACE_OS_VARS=true \
HOME=/home/ejabberd \
PATH="$PATH:/home/ejabberd/bin" \
VERSION=${VERSION:-latest}
LABEL maintainer="ProcessOne <contact@process-one.net>" \
product="Ejabberd Community Server Official Docker Image" \
version=$VERSION \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/processone/docker-ejabberd" \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="Ejabberd Community Server Official Docker Image" \
org.label-schema.description="Robust, Scalable and Extensible Realtime Server using XMPP, MQTT and SIP" \
org.label-schema.url="https://www.ejabberd.im/" \
org.label-schema.vendor="ProcessOne" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0"
# Create directory structure and user for ejabberd
RUN addgroup ejabberd -g 9000 \
&& adduser -s /bin/sh -D -G ejabberd ejabberd -u 9000 \
&& mkdir -p /home/ejabberd/conf /home/ejabberd/database /home/ejabberd/logs /home/ejabberd/upload \
&& chown -R ejabberd:ejabberd /home/ejabberd \
&& ln -fs /home/ejabberd /opt/ejabberd \
&& ln -fs /home/ejabberd /opt/ejabberd-$VERSION
# Install required dependencies
RUN apk upgrade --update-cache --no-progress \
&& apk add \
expat \
freetds \
gd \
jpeg \
libgd \
libpng \
libstdc++ \
libwebp \
ncurses-libs \
openssl \
sqlite \
sqlite-libs \
tini \
unixodbc \
yaml \
zlib \
&& ln -fs /usr/lib/libtdsodbc.so.0 /usr/lib/libtdsodbc.so \
&& rm -rf /var/cache/apk/*
# Install ejabberd
WORKDIR $HOME
COPY --from=builder /ejabberd/runtime .
COPY bin/* bin/
COPY --from=api /go/bin/ejabberdapi bin/ejabberdapi
RUN chmod 755 bin/ejabberdctl bin/ejabberdapi bin/erl bin/captcha*.sh \
&& mkdir -p /home/ejabberd/sql \
&& cp /home/ejabberd/lib/ejabberd-*/priv/sql/* /home/ejabberd/database/ \
&& cp /home/ejabberd/lib/ejabberd-*/priv/sql/* /home/ejabberd/sql/
COPY --chown=ejabberd:ejabberd conf conf/
ADD --chown=ejabberd:ejabberd https://download.process-one.net/cacert.pem conf/cacert.pem
# Setup runtime environment
.............more configurations .......................
Metadata
Metadata
Assignees
Labels
No labels
Activity
badlop commentedon Apr 23, 2025
Quite strange that you can build in linux and the exact same files fail in Mac.
That is the first error message, the one that triggers all the other errors. Maybe there's some problem in elixir 1.15.7 specific to Mac?
I guess if you use an alpine image newer than 3.19, it will use an elixir newer than 1.15.7, just to see if the problem disappears.
Alternatively, you can try building the
ejabberdcontainer image instead of theecsimage. The usage of both images is almost identical, but their build methods are different, and the included versions are different.hvar90 commentedon Apr 23, 2025
i changed to docker.io/golang:1.24.2-alpine AS api
and docker.io/alpine:3.21.3
i am using the latest version of alpine
https://hub.docker.com/_/alpine
but it is using elixir 1.15.7 still and i get the same error message
i found some people had similar errors on mac
do you think there is a relation with my problem?
https://stackoverflow.com/questions/45764045/trouble-installing-elixir-1-5-on-osx
http://github.com/elixir-lang/elixir/issues/9932
i tried this method
as ejabberd container image said
but i got the same error
hvar90 commentedon Mar 7, 2026
Hi again, i downloaded the last version of this github and the previous error I had is now fixed, maybe it got fixed thanks to this fix #125, but now another error occurs later in the building
but the error does not always occur on the same line, sometimes it happens later
which is strange because I'm running the same files with the same command and the error appears in different places.
i used this command
but also i use these other commands
having this build.sh
i was using QEMU (Legacy) and i tried to change the Virtual Machine Options of Docker
i selected
Apple Virtualization framework
using Rosetta for x86_64/amd64 emulation on Apple Silicon
but i got the same error
this is my Dockerfile
also i tried to build for arm64 on my MAC
i got this error
only amd64 is possible using --platform linux/amd64 flag but using that flag i got the error i wrote before
badlop commentedon Mar 12, 2026
I don't know if it will be related, but some time ago Qemu had a bug and it crashed compiling "ejabberd" container images with it. The first workaround at that time to build "ejabberd" containers for arm using i386 was using crosstool...
Later when Qemu got fixed, it was used again...
But nowadays the "ejabberd" container images are built using native github runners, so Qemu is no longer used to build amd64 and arm64 images.
On the other hand, the "ecs" container images that you are using right now are only built for amd64, so there is no experience building it with Qemu. In theory it should work, if you are using a recent Qemu version that doesn't have that old bug.
Notice that the "ecs" and "mix" container images are built only for amd64.
In my amd64 machine it works:
As you noticed, the "ecs" container image is based on the "mix" container image, which is only built for amd64, not ARM.
Alternatively, you could try using the "ejabberd" container image, which is based on the "erlang" container image, and fortunately that one is built for arm and many other architectures.
If you are already using the "ecs" container image and switch to use the "ejabberd" container image, in theory all paths should be compatible and not require any changes in your start script. But just in case, check the images comparison table.