Error when balena pushing with costum base-image

Hi all,
First of all, I am not a docker nor a balena expert.

I get an error on balena push {appname}. The error is

The command ‘/bin/sh -c mkdir -p /buildroot/rebar3/bin’ returned a non-zero code: 2

I am using a custom base image:

FROM erlang/alpine

COPY qemu-arm-static /usr/bin/

My Dockerfile is:

# Build stage 0
ARG VERSION=latest
FROM heyoka/balena-erlang-alpine:$VERSION AS alpine

# Set working directory
RUN mkdir -p /buildroot/rebar3/bin
WORKDIR /buildroot

# Copy our Erlang test application
COPY ./ faxe

# And build the release
WORKDIR faxe
# need git
RUN apk add --no-cache git

RUN rebar3 as prod release

# Build stage 1
FROM alpine

# Install some libs
RUN apk add --no-cache openssl && \
    apk add --no-cache ncurses-libs

ENV RELX_REPLACE_OS_VARS true

# Install the released application
COPY --from=0 /buildroot/faxe/_build/prod/rel/faxe /faxe

# Expose relevant ports
## http api
EXPOSE 8081
EXPOSE 102
EXPOSE 502
EXPOSE 1883
EXPOSE 8883

ENTRYPOINT ["/faxe/bin/faxe"]
CMD ["foreground"]

I can build the image just fine on 2 different machines with local docker, Build command is docker build -t faxe-docker .

As I said, the error occurs when is try to balena push. It seems as there is no apk available, but that does not make any sense. Can anybody give me advise as to where to look for a solution.
Thanks, alex

Does you base image support the arm platform? If it’s multi-arch image there is an open issue with the backend about supporting those properly…

Hi robertgzr, thanks for your answer, in fact I think the erlang image is what you call multi-arch, because when I search for arm64v8/erlang I get the same image as for other architectures. Do you have any suggestions, what I could do. I searched for an erlang base image in the balena base-images, but could not find any.

You can check if an image is multi-arch using the manifest subcommand of the docker cli:
docker manifest inspect <image>. It will respond with a JSON object that describes the platform images it points to…

If that work for you using local mode with the device circumvents the cloud builder and therefore enables you to use this particular image.

Otherwise you would probably need to build an erlang base image yourself by using balenalib/%%BALENA_ARCH%%-alpine and adding what you need to that…

Ok, thank you, I will check that.

Cool if you want to share your results or have any more questions, please let us know o/

Ok, so with docker manifest inspect erlang I found out that this image is multi-arch, supporting 6 different architectures.
I decided to go with a balenalib base image and to build erlang in my main Dockerfile.
This works perfectly ! Thank you for your advice.
(Still need to figure out how to push the balena-erlang-alpine base image to docker-hub without being able to build it locally :wink: )
alex