简体   繁体   中英

Unable to Build Docker Image Using GitHub Actions

I'm currently trying to build a Docker image using GitHub Actions (CI). I can successfully build it on my machine and multiple other x86_64 architectures which I believe GitHub Actions also runs, but when building, I experience the following issue:

standard_init_linux.go:219: exec user process caused: exec format error
The command '/bin/sh -c apt-get update && apt-get install -y build-essential psmisc ifupdown omxplayer x11-xserver-utils xserver-xorg libraspberrypi0 libraspberrypi-dev raspberrypi-kernel-headers cec-utils libpng12-dev git-core wget --no-install-recommends && apt-get clean && rm -rf /var/lib/apt/*' returned a non-zero code: 1

I've searched multiple other threads here, but I wasn't able to find anything useful and I'm not quite sure what else to try. Any help or suggestions would be much appreciated.

Relevant Files:

This is the full build log

This is the Dockerfile

This is the CI file

This is the full repository

Your base image is invalid for amd64:

$ docker image inspect balenalib/raspberry-pi-debian-node:latest-jessie
...
        "Architecture": "amd64", 
...                              

$ docker run -it --rm balenalib/raspberry-pi-debian-node:latest-jessie /bin/bash
...
root@2eb37d8359ed:/# dpkg --print-architecture
armhf

That base image won't run on systems without qemu's binfmt_misc configured to run binaries for other platforms.

It's actually not a multi-platform base image at all, and instead is only designed to run on systems with qemu setup (note the media type is a manifest and not a manifest list):

$ regctl image manifest --list balenalib/raspberry-pi-debian-node:latest-jessie                                                                                                                                                                                                 
{                                                                                                                                                                                                                                                                               
  "schemaVersion": 2,                                                                                                                                                                                                                                                           
  "mediaType": "application/vnd.docker.distribution.manifest.v2+json",                                                                                                                                                                                                          
  "config": {                                                                                                                                                                                                                                                                   
    "mediaType": "application/vnd.docker.container.image.v1+json",                                                                                                                                                                                                              
    "size": 11726,                                                                                                                                                                                                                                                              
    "digest": "sha256:5ec0839ecb046f260ad72751d0c4b08c7a085b147a519619e5a54876643a3231"                                                                                                                                                                                         
  },                                                                                                                                                                                                                                                                            
  "layers": [                                                                                                                                                                                                                                                                   
    {                                                                                                                                                                                                                                                                           
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",                                                                                                                                                                                                         
      "size": 40222636,                                                                                                                                                                                                                                                         
      "digest": "sha256:d84b7435af12678c551b7489227b74c994981386b5bc4875ec512e11f28249c5"                                                                                                                                                                                       
    },

And the image configuration has more pointers to qemu:

$ regctl image inspect balenalib/raspberry-pi-debian-node:latest-jessie            
{                                                                                                                              
  "created": "2019-05-02T22:50:58.241895826Z",                         
  "architecture": "amd64",                                           
  "os": "linux",                                                                         
  "config": {                                                                                                                                                                                                                                                                   
    "Env": [                                                                                                                                                                                                                                                                    
      "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",                                                                                                                                                                                                      
      "LC_ALL=C.UTF-8",                                                                                                                                                                                                                                                        
      "DEBIAN_FRONTEND=noninteractive",                                                        
      "UDEV=off",               
      "QEMU_CPU=arm1176",                                            
      "NODE_VERSION=11.14.0",                                                                                                                                                                                                                                                   
      "YARN_VERSION=1.12.3"                                                                                                                                                                                                                                                     
    ],    

This won't work on hosts without qemu's binfmt-misc setup. For building within a github action, you can use the setup qemu action :

  - name: Set up QEMU
    id: qemu
    uses: docker/setup-qemu-action@v1
    with:
      image: tonistiigi/binfmt:latest
      platforms: all

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM