buildx icon indicating copy to clipboard operation
buildx copied to clipboard

armv7 docker image created with QEMU action causes Illegal instruction

Open gregordr opened this issue 5 years ago • 3 comments

I build my docker images on Github, for three architectures at once. For the backend, I had to go through hoops and instead using node:latest, use ubuntu:latest so that I can use glibc >= 2.29. However, it looks like launching anything that is installed when building that file - so npm or nodejs - will cause the image to crash on armv7, while working on x86_64:

backend_1   | #
backend_1   | # Fatal error in , line 0
backend_1   | # unreachable code
backend_1   | #
backend_1   | #
backend_1   | #
backend_1   | #FailureMessage Object: 0xbecf23ecIllegal instruction (core dumped)

Here is the Dockerfile:

FROM ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install nodejs npm -y
RUN apt install ca-certificates -y
RUN update-ca-certificates --fresh
RUN npm install -g npm@latest
WORKDIR /code
EXPOSE 4000
COPY package*.json ./
RUN npm i
COPY . .
VOLUME /code/media
CMD "npm" "start"

And the relevant action:

runs-on: ubuntu-latest
steps:
  - uses: actions/checkout@v2
  -
    name: Set up QEMU
    uses: docker/setup-qemu-action@v1
  -
    name: Set up Docker Buildx
    uses: docker/setup-buildx-action@v1
  -
    name: Login to DockerHub
    uses: docker/login-action@v1 
    with:
      username: ${{ secrets.DOCKERHUB_USERNAME }}
      password: ${{ secrets.DOCKERHUB_TOKEN }}
  -
    name: Build and push
    id: docker_build
    uses: docker/build-push-action@v2
    with:
      push: true
      tags: XXXXXXXXXX/backend:latest
      context: backend
      file: ./backend/Dockerfile
      platforms: linux/amd64,linux/arm64,linux/arm/v7
  -
    name: Image digest
    run: echo ${{ steps.docker_build.outputs.digest }}

I assume the problem is using apt while using QEMU actions (which are, AFAIK, behind the hood buildx commands)? If there is a fix for that, I'm happy to take it. If there is a way to get node/npm and glibc >= 2.29 at the same time, without using apt, then I'm happy about that solution too. Basically anything that helps my mess works for me!

Thank you very much for your help!

gregordr avatar Jan 31 '21 20:01 gregordr

I have the same problem. One out of three different containers crashes with error 132, illegal instruction. lscpu: Architecture: armv7l Byte Order: Little Endian CPU(s): 1 On-line CPU(s) list: 0 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 1 Vendor ID: ARM Model: 2 Model name: Cortex-A8 Stepping: r3p2 CPU max MHz: 1000.0000 CPU min MHz: 300.0000 BogoMIPS: 995.32 Flags: half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpd32

rytai avatar Mar 16 '21 07:03 rytai

Would need a repro like https://github.com/docker/buildx/issues/317#issue-650705145 (https://github.com/mhozza/docker-webpack-test) so we can test on our side. Thx.

crazy-max avatar Feb 17 '22 16:02 crazy-max

I think that this issue has plenty of steps to reproduce the issue: https://github.com/docker/buildx/issues/328

timbru31 avatar Mar 14 '22 10:03 timbru31