codeskin
codeskin

Reputation: 197

qemu-x86_64: Could not open '/lib/ld-musl-x86_64.so.1': No such file or directory

Has anyone come across this error when trying to execute a docker-compose up command.

I have tried to resolve it by looking at other articles that touch on something similar but I am having no success.

I am trying to run my spring boot app using a docker-compose file and I keep getting this error:

qemu-x86_64: Could not open '/lib/ld-musl-x86_64.so.1': No such file or directory

I have tried to fix it by following the advice I read online but nothing has worked.

I have tried:

After reading this post: https://github.com/nodejs/help/issues/3239 adding the following

platform: linux/amd64

to my docker-compose file but it doesn't make a difference

and tried FROM --platform=linux/amd64 in front of my Dockerfile

When I read this I tried to install musl as well but failed to execute the make command

curl https://musl.libc.org/releases/musl-1.2.2.tar.gz -o musl-1.2.2.tar.gz
tar -xvf musl-1.2.2.tar.gz
cd musl-1.2.2
./configure
make 
make install

My Docker file looks like this

FROM azul/zulu-openjdk-alpine:11 as packager

RUN { \
        java --version ; \
        echo "jlink version:" && \
        jlink --version ; \
    }

ENV JAVA_MINIMAL=/opt/jre

# build modules distribution
RUN jlink \
    --verbose \
    --add-modules \
        java.base,java.sql,java.naming,java.desktop,java.management,java.security.jgss,java.instrument \
        # java.naming - javax/naming/NamingException
        # java.desktop - java/beans/PropertyEditorSupport
        # java.management - javax/management/MBeanServer
        # java.security.jgss - org/ietf/jgss/GSSException
        # java.instrument - java/lang/instrument/IllegalClassFormatException
    --compress 2 \
    --strip-debug \
    --no-header-files \
    --no-man-pages \
    --output "$JAVA_MINIMAL"

# Second stage, add only our minimal "JRE" distr and our app
FROM alpine

ENV JAVA_MINIMAL=/opt/jre
ENV PATH="$PATH:$JAVA_MINIMAL/bin"

COPY --from=packager "$JAVA_MINIMAL" "$JAVA_MINIMAL"
COPY "build/libs/company-coordinator-app-0.0.1-SNAPSHOT.jar" "/company-coordinator-app.jar"

EXPOSE 8080
CMD [ "-jar", "/company-coordinator-app.jar" ]
ENTRYPOINT [ "java" ]

and my docker-compose.yml file looks like this

    version: '2'
services:
  company-coordinator-app:
    container_name: 'company-coordinator-app'
    build:
        context: /Users/ciaran/cmkdev/company-coordinator-project/company-coordinator-app
        dockerfile: Dockerfile
    image: springio/gs-spring-boot-docker
    ports:
      - "8080:8080"

I am running this off an M1 mbp

I read this post on here in an attempt to build my Dockerfile correctly as I needed to use Java 11.

Java 11 application as lightweight docker image

If anyone has any insights here it would be greatly appreciated.

Upvotes: 9

Views: 20932

Answers (1)

Rohit Tandon
Rohit Tandon

Reputation: 51

It seems azul/zulu-openjdk-alpine:11 doesn't have arm64 image needed to run on Apple silicon architecture.

Try updating to jdk 17 image with arm64 support https://hub.docker.com/r/azul/zulu-openjdk-alpine/

Upvotes: 2

Related Questions