question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Docker-Compose shenyu services image not support arm64(Raspberry Pi 4 Model B) architecture

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Docker-Compose file:

master/shenyu-dist/shenyu-docker-compose-dist/src/main/resources/stand-alone-mysql/docker-compose.yaml

shenyu-admin Docker file: master/shenyu-dist/shenyu-admin-dist/Dockerfile

shenyu-bootstrap Docker file: master/shenyu-dist/shenyu-bootstrap-dist/Dockerfile

I noticed that shenyu-admin and shenyu-bootstrap are both built on the openjdk:8-jre-alpine image, but this image does not support the arm64 CPU architecture of the Raspberry Pi 4 Model B, which prevents the shenyu services from running successfully.

The openjdk:8-jre-alpine image does not support the arm64 CPU architecture: image

Expected Behavior

Make it work, thanks.

Steps To Reproduce

An error occurs after executing the following command:

curl https://raw.githubusercontent.com/apache/incubator-shenyu/master/shenyu-dist/shenyu-docker-compose-dist/src/main/resources/install.sh | bash -s master mysql

Environment

ShenYu version(s): 2.4.2

Debug logs

ubuntu@ubuntu:~/apache-shenyu/shenyu-master$ docker-compose ps
      Name                    Command                  State                        Ports
-----------------------------------------------------------------------------------------------------------
db                 /usr/local/bin/docker-entr ...   Up (healthy)   0.0.0.0:3310->3306/tcp,:::3310->3306/tcp
shenyu-admin       /bin/sh entrypoint.sh            Exit 1
shenyu-bootstrap   /bin/sh entrypoint.sh            Exit 1
ubuntu@ubuntu:~/apache-shenyu/shenyu-master$ docker-compose logs -f shenyu-admin
Attaching to shenyu-admin
shenyu-admin        | standard_init_linux.go:228: exec user process caused: exec format error
shenyu-admin        | standard_init_linux.go:228: exec user process caused: exec format error
shenyu-admin exited with code 1
ubuntu@ubuntu:~/apache-shenyu/shenyu-master$ docker-compose logs -f shenyu-bootstrap
Attaching to shenyu-bootstrap
shenyu-bootstrap    | standard_init_linux.go:228: exec user process caused: exec format error
shenyu-bootstrap    | standard_init_linux.go:228: exec user process caused: exec format error
shenyu-bootstrap exited with code 1

Anything else?

Using the arm64v8/openjdk:8-jre image in our project can run successfully(I’m actually using arm64v8/openjdk:8 😂).

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
JooKS-mecommented, Apr 8, 2022

Hi @myesn , I reproduced your problem locally 😃

I find that the base image you used openjdk:8u322-jre will make the env of spring invalid.

There may be no problem in the dockerfile, and it is recommended not to modify it. I read the log of your shenyu-bootstrap, that is probably because shenyu-admin failed to start successfully, not because of the image problem of openjdk.

1reaction
myesncommented, Apr 8, 2022

@JooKS-me Thank you very much for your reply, I have compiled the following information for your reference.

All of the following steps are performed on the Raspberry Pi:

1. Download and extract v2.4.2 Souce code(tar.gz) 2. Open and edit the contents of incubator-shenyu-2.4.2/shenyu-dist/shenyu-admin-dist/Dockerfile and incubator-shenyu-2.4.2/shenyu-dist/shenyu-bootstrap-dist/Dockerfile files:

changes
# 1. Replace `FROM openjdk:8-jre-alpine` with:
FROM openjdk:8u322-jre

# 2. Replace `apk --no-cache add procps` with:
RUN apt-get update && \
    apt-get install -y --no-install-recommends procps && \
    rm -rf /var/lib/apt/lists/*

3. Switch to the incubator-shenyu-2.4.2/shenyu-dist directory and execute the following command (Total time 10:51 min):

mvn clean install -Dmaven.javadoc.skip=true -B -Drat.skip=true -Djacoco.skip=true -DskipITs -DskipTests -Prelease,docker

Although the following warning appears during the build process, the final result is BUILD SUCCESS:

warning logs
[INFO] --- maven-assembly-plugin:3.0.0:single (admin-bin) @ shenyu-admin-dist ---
[INFO] Reading assembly descriptor: /home/ubuntu/shenyu/incubator-shenyu-2.4.2/shenyu-dist/shenyu-admin-dist/src/main/assembly/binary.xml
[WARNING] The assembly descriptor contains a filesystem-root relative reference, which is not cross platform compatible /
[WARNING] Cannot include project artifact: org.apache.shenyu:shenyu-admin-dist:pom:2.4.2; it doesn't have an associated file or directory.

[INFO] --- maven-assembly-plugin:3.0.0:single (bootstrap-bin) @ shenyu-bootstrap-dist ---
[INFO] Reading assembly descriptor: /home/ubuntu/shenyu/incubator-shenyu-2.4.2/shenyu-dist/shenyu-bootstrap-dist/src/main/assembly/binary.xml
[WARNING] The assembly descriptor contains a filesystem-root relative reference, which is not cross platform compatible /
[WARNING] Cannot include project artifact: org.apache.shenyu:shenyu-bootstrap-dist:pom:2.4.2; it doesn't have an associated file or directory.
docker images output
ubuntu@ubuntu:~/shenyu/docker/shenyu-v2.4.2$ docker images
REPOSITORY                TAG         IMAGE ID       CREATED          SIZE
apache/shenyu-bootstrap   2.4.2       c2ed2d3e9c8e   28 minutes ago   557MB
apache/shenyu-bootstrap   latest      c2ed2d3e9c8e   28 minutes ago   557MB
apache/shenyu-admin       2.4.2       260bf5284967   34 minutes ago   426MB
apache/shenyu-admin       latest      260bf5284967   34 minutes ago   426MB
openjdk                   8u322-jre   285c82c72a84   8 days ago       265MB
portainer/portainer-ce    2.11.1      8000bafa387b   8 weeks ago      267MB
mariadb                   10.2.41     9af1a2a8b723   2 months ago     325MB

4. Execute the following command to download the v2.4.2 install.sh file (auto-execute), the script will create a shenyu-v2.4.2 directory, since the database does not support arm64 architecture, this script will terminate when it outputs Pulling db(docker.io/mysql:5.7):

curl https://raw.githubusercontent.com/apache/incubator-shenyu/v2.4.2/shenyu-dist/shenyu-docker-compose-dist/src/main/resources/install.sh | bash -s v2.4.2 mysql

5. Open the shenyu-v2.4.2/docker-compose.yaml file and modify the following:

changes
1. Replace the `v2.4.2` tag character in the `image` value in the `shenyu-bootstrap` service with `2.4.2`
2. Replace the `v2.4.2` tag character in the `image` value in the `shenyu-admin` service with `2.4.2`
3. Add a new environment variable `shenyu.register.props.checked=false` to the `environment` of the `shenyu-admin` service
4. Replace the `image` value in the `db` service with `mariadb:10.2.41` ([[type: refactor] Change mysql image to mariadb in docker-compose yaml](https://github.com/apache/incubator-shenyu/pull/3210))
docker-compose.yaml
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

version: "2.1"
services:
  shenyu-bootstrap:
    image: apache/shenyu-bootstrap:2.4.2
    container_name: shenyu-bootstrap
    ports:
      - "9195:9195"
    volumes:
      - ./shenyu-bootstrap/logs/:/opt/shenyu-bootstrap/logs
      - ./shenyu-bootstrap/conf/:/opt/shenyu-bootstrap/conf
    links:
      - shenyu-admin:admin
    depends_on:
      - shenyu-admin
    environment:
      - shenyu.sync.websocket.urls=ws://admin:9095/websocket
  shenyu-admin:
    image: apache/shenyu-admin:2.4.2
    container_name: shenyu-admin
    environment:
      - spring.profiles.active=mysql
      - spring.datasource.url=jdbc:mysql://db:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false
      - spring.datasource.username=root
      - spring.datasource.password=xyzj1a2y3
      - shenyu.register.props.checked=false
    volumes:
      - ./shenyu-admin/logs/:/opt/shenyu-admin/logs
      - ./shenyu-admin/conf/:/opt/shenyu-admin/conf
      - ./shenyu-admin/ext-lib/:/opt/shenyu-admin/ext-lib
    ports:
      - "9095:9095"
    links:
      - db:db
    depends_on:
      db:
        condition: service_healthy
  db:
    image: mariadb:10.2.41
    container_name: db
    environment:
      MYSQL_ROOT_PASSWORD: xyzj1a2y3
      MYSQL_DATABASE: shenyu
    ports:
      - 3310:3306
    healthcheck:
      test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-pxyzj1a2y3" ]
      interval: 6s
      timeout: 5s
      retries: 10

6. Execute docker-compose up -d command to start the service collection, all 3 services are created and started successfully, then execute docker-compose logs -f shenyu-admin to view the logs:

shenyu-admin logs

From the logs, we can see that the shenyu-admin program is using the h2 profile, but the environment variable configured in docker-compose.yaml is mysql.

So I went inside the shenyu-admin container to check the environment variables and found no problems:

shenyu-admin environment variables inside the container
ubuntu@ubuntu:~/shenyu/docker/shenyu-v2.4.2$ docker-compose exec shenyu-admin bash
root@e289bd63ba2a:/opt/shenyu-admin# printenv
shenyu.register.props.checked=false
spring.profiles.active=mysql
spring.datasource.username=root
spring.datasource.url=jdbc:mysql://db:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.password=xyzj1a2y3
HOSTNAME=e289bd63ba2a
JAVA_HOME=/usr/local/openjdk-8
PWD=/opt/shenyu-admin
LOCAL_PATH=/opt/shenyu-admin
HOME=/root
LANG=C.UTF-8
TERM=xterm
SHLVL=1
PATH=/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
JAVA_VERSION=8u322
_=/usr/bin/printenv

7. So I opened the docker-compose.yaml file and replaced spring.profiles.active=mysql with SPRING_PROFILES_ACTIVE=mysql in the environment of the shenyu-admin service:

docker-compose.yaml
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

version: "2.1"
services:
  shenyu-bootstrap:
    image: apache/shenyu-bootstrap:2.4.2
    container_name: shenyu-bootstrap
    ports:
      - "9195:9195"
    volumes:
      - ./shenyu-bootstrap/logs/:/opt/shenyu-bootstrap/logs
      - ./shenyu-bootstrap/conf/:/opt/shenyu-bootstrap/conf
    links:
      - shenyu-admin:admin
    depends_on:
      - shenyu-admin
    environment:
      - shenyu.sync.websocket.urls=ws://admin:9095/websocket
  shenyu-admin:
    image: apache/shenyu-admin:2.4.2
    container_name: shenyu-admin
    environment:
      - SPRING_PROFILES_ACTIVE=mysql
      - spring.datasource.url=jdbc:mysql://db:3306/shenyu?useUnicode=true&characterEncoding=utf-8&useSSL=false
      - spring.datasource.username=root
      - spring.datasource.password=xyzj1a2y3
      - shenyu.register.props.checked=false
    volumes:
      - ./shenyu-admin/logs/:/opt/shenyu-admin/logs
      - ./shenyu-admin/conf/:/opt/shenyu-admin/conf
      - ./shenyu-admin/ext-lib/:/opt/shenyu-admin/ext-lib
    ports:
      - "9095:9095"
    links:
      - db:db
    depends_on:
      db:
        condition: service_healthy
  db:
    image: mariadb:10.2.41
    container_name: db
    environment:
      MYSQL_ROOT_PASSWORD: xyzj1a2y3
      MYSQL_DATABASE: shenyu
    ports:
      - 3310:3306
    healthcheck:
      test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-pxyzj1a2y3" ]
      interval: 6s
      timeout: 5s
      retries: 10

8. Execute docker-compose down -v (for a clearer view of the logs), then execute docker-compose up -d again, wait for a successful start and then execute docker-compose logs -f shenyu-admin to view the logs:

shenyu-admin logs

From the output log, we can see that active profile is already correctly configured for mysql, but there is a Communications link failure error, which causes the program to run abnormally.

That’s all the steps and the process.

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Docker-Compose shenyu services image not support ...
[BUG] Docker-Compose shenyu services image not support arm64(Raspberry Pi 4 Model B) architecture #3166. Open. 1 task done.
Read more >
Raspberry Pi 4 - Docker: no matching manifest for linux/arm/v7 ...
I've installed docker on my stock Raspberry Pi 4 OS and I am attempting to ... it seems ktranslate may not be available...
Read more >
Docker and Docker Compose on Raspberry Pi OS
How to install Docker on RPi 2, 3 and 4 with the new Raspberry Pi OS, for 32 and 64-bit.
Read more >
Install Docker-Compose on Raspberry Pi - JFrog Connect
In this tutorial, we show you the steps to follow to install Docker Compose on Raspberry Pi. Continue reading for more elaboration.
Read more >
ARM64 Support - LocalStack Docs
Using AMD64 Lambda functions and binaries on ARM64. If you want to execute Docker Lambda functions or binaries which have not been built...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found