Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker image not working on linux/amd64 #437

Open
jeremiemartel opened this issue Oct 30, 2023 · 2 comments
Open

Docker image not working on linux/amd64 #437

jeremiemartel opened this issue Oct 30, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@jeremiemartel
Copy link

Describe the bug
Cannot run a container using image from docker hub on linux/amd64 platform.

To Reproduce
docker run --rm clevy/csml-engine:latest

exec /bin/sh: exec format error

Expected behavior
Supposed to launch csml engine.

Additional context
It looks like you are copying compiled binaries in Dockerfile instead of building it inside docker image, and you copied arm binary and not amd version.

image

@jeremiemartel jeremiemartel added the bug Something isn't working label Oct 30, 2023
@703lovelost
Copy link

@jeremiemartel Probably any updates on this? I'm having the same issue, no idea what to do next.

@jeremiemartel
Copy link
Author

Hi,
I had no answer, project seems to be dead, the solution I used (probably not the best) is to build my own docker image with pre compiled binaries, and add a script to select binary to execute depending on architecture.

My File architecture:
| Dockerfile
| pre_build.sh
| src
| | choose_server.sh
| | bin
| | | csml-server-linux-aarch64
| | | csml-server-linux-amd64

Dockerfile

FROM --platform=$TARGETPLATFORM ubuntu:22.04
ARG TARGETPLATFORM

WORKDIR /usr/src/csml

RUN apt update && apt install -y wget ca-certificates libpq-dev entr python3-minimal python3.10-venv && apt clean
RUN update-ca-certificates

# install csml server
COPY ./tmp/bin ./bin
COPY ./tmp/choose_server.sh .
RUN bash ./choose_server.sh && rm ./choose_server.sh
RUN chmod 755 server

ENTRYPOINT ["./server"]

pre_build.sh

#!/bin/bash

set -e
cd $(dirname $0)

mkdir -p tmp tmp/bin

cp ./src/choose_server.sh ./tmp
cp ./src/bin/csml-server-linux-aarch64  ./src/bin/csml-server-linux-amd64 tmp/bin

choose_server.sh

#!/bin/bash

set -e

if [ "$TARGETPLATFORM" == "linux/amd64" ] ; then
  mv ./bin/csml-server-linux-amd64 server
  rm -rf bin
elif [ "$TARGETPLATFORM" == "linux/arm64" ] ; then
  mv ./bin/csml-server-linux-aarch64 server
  rm -rf bin
else
  echo "Invalid target platform: $TARGETPLATFORM"
  exit 1
fi

Hope this can help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants